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.
| Author |
Topic |
|
vinay789
Starting Member
40 Posts |
Posted - 2009-04-18 : 10:44:47
|
| Hii am a newbie to ms sql i want to generate dynamic query in ms sqli.e., wen one of the user logged in to his account i want to retrive that user data only. For example user1,user2 are two users of my database i want to retive his values.i.e.,i am concatinating my select statement in a string variable at runtime and execute it. .Any suggestions.Thanx |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-04-18 : 14:51:50
|
| why use dynamic sql for that? assuming you've a table field which stores usernames isnt it just of matter of using function SUSER_SNAME() to retrive logged in user info and then compare it with table field to retrive only that users data? |
 |
|
|
vinay789
Starting Member
40 Posts |
Posted - 2009-04-20 : 05:47:39
|
quote: Originally posted by visakh16 why use dynamic sql for that? assuming you've a table field which stores usernames isnt it just of matter of using function SUSER_SNAME() to retrive logged in user info and then compare it with table field to retrive only that users data?
Hii am a newbie i didnt understand wat u have told me i will tell clearly in my db there are 10 registered usernames wen one of the user logged in to my site i want to display his information i am using ms sql db pls tell me how to give a select query for this with example |
 |
|
|
|
|
|