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 |
|
jimoomba
Yak Posting Veteran
90 Posts |
Posted - 2011-10-03 : 05:04:34
|
| Hi All,Iam having a query which gives the desired output as shown below :DECLARE @counter INT=0SELECT @counter = @counter |CONVERT(INT, RoleID) from UsersRoles where UserID = 23select @counter as ResultPlease let me know the query to show the same result without using parameter.Thanks,Ramrams |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-03 : 05:17:39
|
| [code]SELECT 0 |CONVERT(INT, RoleID) from UsersRoles where UserID = 23[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
jimoomba
Yak Posting Veteran
90 Posts |
Posted - 2011-10-03 : 05:21:29
|
| Hi Visakh,SELECT 0 |CONVERT(INT, RoleID) from UsersRoles where UserID = 23This query returns the values but not the output result :(rams |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-03 : 05:23:40
|
| what does that mean? whats output result and what its giving?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
jimoomba
Yak Posting Veteran
90 Posts |
Posted - 2011-10-03 : 05:32:49
|
| SELECT 0 |CONVERT(INT, RoleID) from UsersRoles where UserID = 23this query give the output as :NoCulumn-------4 2But the output should be :6,rams |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-03 : 05:35:38
|
| how do you think it will merge resultset? it will apply it on each row and give result so two rows means 2 values in resultset unless you apply some kind of aggregation------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
jimoomba
Yak Posting Veteran
90 Posts |
Posted - 2011-10-03 : 05:38:26
|
| could you aggregate that and write the query for me..it would be great helprams |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2011-10-03 : 08:18:40
|
| why don't you give the query a try? help is one thing, doing ALL the work for you is another...http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|
|
|