sql

how to remove NullExceptionError from Session Variable

Hi, Hi , I have a varible sem,which takes inputfrom the textbox but if the textbox is kept empty i want it to return "Please Enter a Semester" int sem; int parsevalue; if (int.TryParse(TextBox2.Text, out parsevalue)) { sem = parsevalue; Session["Sem"] = sem; } else { Literal2.Text = "...

Join performace

My situation is: Table member id firstname lastname company address data ( 5 fields ) contact data ( 2 fields ) etc Table member_profile member_id html ( something like <h2>firstname lastname</h2><h3>Company</h3><span>date_registration</span> ) date_activity chat_status Table news id member_id (fk to member_id in member_profile) title...

Data Type for storing Urls

Hi, what is the best data type to store Urls?. I need save on database file system path for pictures. thanks ...

What are the differences and gotchas when changing SQL Server compat mode from 90 to 100?

I would like to know what the implications for my database might be to swap from compat mode 90 (2005) to 100 (2008). Are there any performance enhancements? Are there any deprecated features? ...

SQL LIMIT return 'zero' - 0 - rows(IN PHP)

Hello, I have an error in this query, when the query returns zero rows. Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20,20' at line 3 SELECT pl.name,pl.email FROM players pl JOIN players_bonus pl_b on pl.id = pl_b.id_player WH...

Does Oracle-Procedures do all orders step by step?

Heyho, I'm trying to set a Procedure like: Create or Replace Procedure MyProcedure1( x in number default 1, y in number default 1 ) AS Begin If x = 1 then MyProcedure2; EndIf; If y = 1 then MyProcedure3 EndIf; End MyProcedure1; MyProcedure3 must be done after MyProcedure2 is completely done, because it needs some values which are set...

FULL OUTER JOIN or UNION ?

Hi, confused how to achieve this maybe with FULL OUTER or a UNION. I want to join results in such a way that Table1 Table2 --------------- ----------------- ID Name Salary ID Fruits --------------- ----------------- 1 John 1000 1 Apples 1 Henry 4000 ...

Getting DATETIME for rows inserted/Modified

Hi There, am using SQL server 2005 , i have a requirement to get the Creation datetime of all the rows in a particular table, unfortunately the table do not have any "rowverion" or datetime column ( i know this is a major design flaw). so , i was wondering if SQL server maintains datetime for each row inserts. comments suggestions app...

SQL combine multiple identifiers to create a group id for duplicate records

I'm working on a problem in Oracle that I'm struggling to solve 'elegantly'. I have a data extract with three different identifiers: A, B, C Each identifier may appear in more than one row, and each row may have one or more of these three identifiers (i.e the column is populated or null). I want to be able to group all records that ...

Update all column values in a table with a column value of another table (related by a foreign key)

Hi, I'm trying to populate a new column in a table with data residing in another table's column. UPDATE dbo.PackageSessionNodes SET Created_By = (select userid from dbo.PackageSessions, dbo.PackageSessionNodes where dbo.PackageSessions.PackageSessionId = dbo.Packag...

[MySQL] SELECT query on multiple tables

Hello. I have two tables, foo and bar: +----+-----+ +----+-----+ | id | val | | id | val | +----+-----+ +----+-----+ | 1 | qwe | | 1 | asd | | 2 | rty | | 3 | fgh | +----+-----+ +----+-----+ id is not unique here. Not all IDs in foo have their equivalents in bar and vice versa. I need to count all rows with spec...

SQL select until full sort of problem

Hi I am trying to write some SQL that pulls from several tables using unions, where the date on the rows is less than a hour. But if the total rows from the SQL query doesn't add up to about 20 then it should change the where to the date being less than two hours and so forth until 20 rows retrieved. Is this possible to do solely in S...

Is it possible in sql to group by fields matching some pattern?

Is it possible in SQL to do grouping by LIKE patterns? I would like to achieve something like this: id|name 1 | Mike 2 | Bob 3 | Bill 4 | Alice and then doing query like: SELECT name from users group by _pattern_ For example I would like to get groups by matching patterns 'B*', '*l*' and 'Mike' would give the output: B* ...

TSQL command to call *.sql files

Hi, I have several *.sql files with script to create table and sprocs for a new database. Is there a way to create a TSQL script that could be run from the SQL Query Analyzer that would sequentially call the *.sql files? Example: call scrip 01; call scrip 02; call scrip 03; GO Sorry but I was not able to express my problem properly b...

MySQL - inform program that a duplicate INSERT was attempted

Is there an easy way to return something to your code if a duplicate insert is attempted? I want to do something like this (Obviously doesn't work because (ON DUPLICATE KEY INDEX UPDATE)- query = "INSERT INTO quotes(symbol, date, open, high, low, close, volume, adj)" query += "VALUES ('" + symbol + "', '" + Date + "','" + Open + "','" ...

Why is it that the IsEqual (=) operator is working faster than the IsNotEqual (<>) operator in Oracle?

Like the title says, if anyone has the answer I would like to know. I've been googling but couldn't find a straight answer. Example: This works SELECT COUNT(*) FROM Table1 TB1, Table2 TB2 WHERE TB1.Field1 = TB2.Table2 This seems to take hours SELECT COUNT(*) FROM Table1 TB1, Table2 TB2 WHERE TB1.Field1 <> TB2.Table2 ...

Correct form long time query executing myodbc syntax

I'm trying to build one SQL query for Access that links tables with myodbc connection to retrive the data from internet, but the time to finish the query is too long about five minutes, so I think the problem is with the query: SELECT COUNT([o].[orders_id]) AS howmany_orders, (SELECT SUM([op1].[products_quantity]) FROM orders_to...

help to write a query statement

I need a query statement written such that it searches three tables table 1 id fullname active table 2 id fullname table 3 id fullname I wanted this query to search all three tables combine and give me the result for those id fullname that is not active ...

Ordering Select clause result in specific way

I need help with writing a select clause query. For example, lets say I have a query like that: select value from some_table order by value asc; as a result I get this: 1 2 3 4 5 6 7 8 9 10 but a special query I want to write, is the one which still will give me sorted values, but will put 5 after 8. this means I need one value ...

Error in SQL Server 2005 Syntax

Here is the SQL: CREATE TABLE dbo.TmpFeesToRules1(Name varchar, LookupId int) INSERT INTO dbo.TmpFeesToRules1(Name, LookupId) SELECT DISTINCT Name, 0 FROM Lending.Fee UNION SELECT DISTINCT Name, 0 FROM Lending.ApplicationFee INSERT INTO dbo.tblLookup (LookupType, LookupCode, LookupDesc, EditFlag, DeletedFlag, DefaultFlag) SELECT 'FEE_...