CREATE PROCEDURE AA AS
Declare @MyString Char(30)
Select @MyString="Select * From TStation"
EXECUTE ('CREATE PROCEDURE AAA AS'+@MyString)
>Really?? Could you post the example here for Don? Cool....
>
>>John, you know what? My friend just created stored procedure with text concatenation from variables on-fly (it's SQL Server 6.0).
>>
>>>
>>>Funny, I was just researching the script approach. I'm my Using SQL Server 6.5 book, they mention a \scripts subdirectory for .IDC scripts (maybe .SQL too?) so look at the SQLServer dir tree and maybe it's there?
>>>
>>>>I don't think so... But here is another approach we are now considering...
>>>>
>>>>Use VFP as the front end to create a .SQL script file with the desired statement, then have a single procedure on the back-end with one parameter... the name of the .SQL script. The stored procedure will do nothing but
>>>>
>>>>DO .SQL script (which is the entire query)
>>>>ERASE .SQL script
>>>>
>>>>This seams like an easier approach since VFP has all the low-level editing where we can create the file and assign the filename easier... How would I go about handling the file pathing and file name information as the parameter?
>>>>
>>>>
>>>>
>>>>
>>>>>Don, could you consider two-record interim table, i.e. you put actual values in two or more records there and then call stored procedure which will operate with these values, i.e. no macros substitution/variable needed.
>>>>>
Edward Pikman
Independent Consultant