|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi There,
I have to create a Store procedure which take a full valid SQL SELECT statement As the input parameter, However the code seems to be fine it just that the Store procedure itself is limited to 127 character as the maximum length for the input parameter. Can anybody Suggesting an alternalitive. Thanks Code if @Select = "Select * FROM Nothwind" works fine But however if @Select = ".........................................." Length > 128 then have problem. CREATE PROCEDURE sp1 ( @Select nvarchar(4000) ) declare @mySQL as nvarchar(4000) Set @mySQL = @Select EXEC (@mySQL) return @@rowcount |
|
#2
|
||||
|
||||
|
Yes, you must be generating your SQL from somewhere, like VB, so instead of generating it where you are generating it, use the stored procedure to do the generation and the execution of the SQL string. Stored proc can handle do loops, if statements, case statements, pretty much whatever you need.
Or You can even pass several pieces of the SQL string and the stored proc can string them together, if you prefer to do it that way: set @mySQL = "SELECT * FROM " + @table1 + " WHERE " + @Field1 + " = " + @Where1 |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > StoreProcedure Parameter problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|