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 |
|
jamie_pattison
Yak Posting Veteran
65 Posts |
Posted - 2009-01-09 : 07:19:33
|
Im having problems getting this Stored procedure to work correctly. This procedure "falls over" since adding the additional parameter so im guessing the parameter is where i have gone wrong. Coud anyone assist?ALTER PROCEDURE [dbo].[sp_Some_StoredProcedure] @ValueFromUserASUPDATE TableNameSET IsManager='Y', IsManagerFrom=GetDate() ValueFromUser=@ValueFromUserWHERE SomeColumn = (SELECT DISTINCT MIN(SomeColumn) AS NewSomeColumn FROM TableName WHERE IsManager = 'N') Thanks |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-01-09 : 07:21:25
|
@ValueFromUser has no typeGreetingsWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-09 : 07:27:24
|
quote: Originally posted by jamie_pattison Im having problems getting this Stored procedure to work correctly. This procedure "falls over" since adding the additional parameter so im guessing the parameter is where i have gone wrong. Coud anyone assist?ALTER PROCEDURE [dbo].[sp_Some_StoredProcedure] ( @ValueFromUser datatype)ASUPDATE TableNameSET IsManager='Y', IsManagerFrom=GetDate(), ValueFromUser=@ValueFromUserWHERE SomeColumn = (SELECT DISTINCT MIN(SomeColumn) AS NewSomeColumn FROM TableName WHERE IsManager = 'N') Thanks
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-09 : 08:34:36
|
| no need of DISTINCT in last subquery as MIN() returns only a single value from table. so DISTINCT doesnt make sense. |
 |
|
|
|
|
|