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
 General SQL Server Forums
 New to SQL Server Programming
 help stored procedure

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2011-02-11 : 11:16:00
Hi All.

I have Table1:
ID Result
-------------
1 AAAA
2 BBBB
3 CCCC

And I would like to create SP.
If variable ID=1, the result of select will:
2 BBBB
3 CCCC

If variable ID=2, the result of select will:
2 AAAA
3 CCCC

and so on. How it to do?

Thanks.

Sachin.Nand

2937 Posts

Posted - 2011-02-11 : 11:30:29
select * from yourtable where id != @Id

PBUH

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-02-12 : 03:20:06
hope you will pass only single value through ID and not a list

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-02-14 : 04:58:39
<<
If variable ID=2, the result of select will:
2 AAAA
3 CCCC
>>

How will Id for AAA be 2?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -