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 |
|
svicky9
Posting Yak Master
232 Posts |
Posted - 2005-08-20 : 10:10:12
|
| Hi there I want to give dynamic input to the t-sql code in sql analyzer.how do i do that....Like adding 2 numbersdeclare @a integer,@b integer,@c integer--I dont want to give like this--set @a = 5--set @b = 10set @c = @a + @bcan anyone help me with thisregardsVicVicky |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-08-20 : 12:11:49
|
You could use a stored procedure or a functionegCREATE PROCEDURE YourProc @a int, @b intASSELECT @a + @b AS YourResult Then run like thisEXECUTE YourProc 5, 10 Returns:YourResult----------15AndyBeauty is in the eyes of the beerholder |
 |
|
|
svicky9
Posting Yak Master
232 Posts |
Posted - 2005-08-21 : 18:26:08
|
| i want the sql server to ask me values...like Enter the value of aEnter the value of band so on ...Is there any way of doing thatthank youVicky |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 01:20:10
|
| This thing is the presentation layer issueIf you want to do this in SQL Server, the only way is to run sp with different parameterslikeEXECUTE YourProc 5, 10EXECUTE YourProc 13, 156EXECUTE YourProc -7, 810MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|