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 |
|
paradise_wolf
Starting Member
32 Posts |
Posted - 2006-11-02 : 20:19:33
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~CREATE PROCEDURE RegisterDownload(@UserName, @Title)ASUPDATE CustomerDownlListSET NumDownloads = NumDownloads + 1WHERE UserName = @UserName AND Title = @TitleSET Downloaded = 1 WHEN NumDownloads = QuantityWHERE UserName = @UserName AND Title = @Title~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In ( SET Downloaded = 1 WHEN NumDownloads = Quantity ) sentence I wanted to do what in C# language would be equivalent to:If(UserName == @UserName && Title == @Title ){if (NumDownloads == Quantity) Downloaded = 1;} |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-11-02 : 20:26:56
|
[code]CREATE PROCEDURE RegisterDownload(@UserName varchar(50), @Title varchar(50))ASUPDATE CustomerDownlListSET NumDownloads = NumDownloads + 1WHERE UserName = @UserName AND Title = @TitleUPDATE CustomerDownlListSET Downloaded = 1 WHEN WHERE NumDownloads = QuantityWHEREAND UserName = @UserName AND Title = @Title[/code] KH |
 |
|
|
paradise_wolf
Starting Member
32 Posts |
Posted - 2006-11-02 : 20:41:21
|
| Thank you, khtan |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-11-02 : 21:47:32
|
You need to specify datatypes for the procedure parameters.Something like:CREATE PROCEDURE RegisterDownload(@UserName varchar(40), @Title varchar(40))AS...rest of code... CODO ERGO SUM |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-11-02 : 22:26:27
|
missed that KH |
 |
|
|
|
|
|