Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table name in SQL Parameters
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00795824
Message ID:
00795865
Views:
16
Hi Mark,

The size of one string is limited to 4,000 characters but you can concatenate multiple string variables.
EXECUTE (@SqlStr01 + @SqlStr02 + @SqlStr03 + ... + @SqlStrNN)
>I thought to use that solution, and it seems to be the only solution, but We are limited by 8000 char in the @SQLStr variable, and my store proc is a big one... :-(
>
>So I have to revise my code to have a smaller procedure.
>
>>You've to build and run dynamic sql using EXECUTE command or sp_executesql system sproc.
Declare @Myparam as Varchar(50), @SqlStr varchar (512)
>>
>>Set @MyParam = 'TableName'
>>
>>SET @SqlStr = 'Select * from A_Table as T1 Left join ' + ;
>>		@MyParam + ' as T2 on T2.Id=T1.Id'
>>
>>EXECUTE (@SqlStr)
>>
>>>How can I pass a table name as a parameter in SQL Server 2000 stored procedure?
>>>
>>>For exemple:
>>>
>>>Declare @Myparam as Varchar(50)
>>>
>>>Set @MyParam = 'TableName'
>>>
>>>Select * from A_Table as T1
>>>Left join @MyParam as T2 on T2.Id=T1.Id
>>>
>>>
>>>This sample does not work, but It represent what I'd like to do
>>>
>>>Thanks
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform