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 |
|
alperozgur
Starting Member
16 Posts |
Posted - 2006-07-12 : 09:28:18
|
| Hi;How can i call a store procedure from another store procedure with parameters?I mean what is the correct syntax of the code below@CIKISNO VARCHAR(30),@SATIRNO INT,@PRJ VARCHAR(4)asDECLARE @HARNO VARCHAR(30)SET @HARNO = (SELECT HAREKETNO FROM MALHAREKET (NOLOCK) WHERE ISLEMNO=@CIKISNO AND ISLEM='Ship' AND ISLEMSATIR=@SATIRNOEXEC MalCikis_Ship_Iptal @Proje=@PRJ, @HareketNo=@HARNO, @Yil=Year(GetDate()) |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-12 : 09:33:25
|
| You can't include a stored proc call as a column in a select statement.You can populate a temp table and use that or make the sp into a function and call that in the select.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
alperozgur
Starting Member
16 Posts |
Posted - 2006-07-12 : 09:35:09
|
| It's not a column in select statement. It's only for execute... |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-12 : 10:29:50
|
| Ok I got the brackets confused. Where is the close bracket meant to be for the select statement?SET @HARNO = (SELECT HAREKETNO FROM MALHAREKET (NOLOCK) WHERE ISLEMNO=@CIKISNO AND ISLEM='Ship' AND ISLEMSATIR=@SATIRNOEXEC MalCikis_Ship_Iptal @Proje=@PRJ, @HareketNo=@HARNO, @Yil=Year(GetDate())trydeclare @y intselect @y = Year(GetDate())EXEC MalCikis_Ship_Iptal @Proje=@PRJ, @HareketNo=@HARNO, @Yil=@yThat might solve your problem.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|