Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 hi..question about query

Author  Topic 

charlesling85
Starting Member

1 Post

Posted - 2006-01-29 : 11:41:13
hi i am kind of new to Sql server 2000..i am having trouble with the query like below..i dun wan to use store procedure but wanna know the basic way to solve it..Thanks

let say: of course connection had been set up
int a=3;
string sql = null;
sql = select id, name, age from detail where id=a"; // getting an sqlException here...

nr
SQLTeam MVY

12543 Posts

Posted - 2006-01-29 : 12:12:31
It's nothing to do with sql server - you are just setting the value of a string - probably due to missing double quote.
Don't see how that can get a sqlException.

sql = "select id, name, age from detail where id=a";

Also it should probably be
sql = "select id, name, age from detail where id='a'";


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -