coldfusion - Creating stored procedure using cfstoredproc -
Is it possible to create a stored procedure that uses cfstoredproc? When I run the following, I get the wrong syntax with the 'GO'
myFile.sql
If OBJECIDID ('mill midata', 'P') tap drop Pros get MADADA go go ANSI_LDLS Go Start QUOTED_IDENTIFIER on set as MacDayData @ Sommy_AR AR NVRAR (200); DECLARE @sql AS NVARCHAR (max) SET @sql = N'SELECT * myTable where id = '' '@some_war +' '' excic spave extension sql @ sql ed & lt; Seqquo name = "make gate madatata" datasource = "# milleratatus () #" & gt; #PersvercingLquites (sp_1) # & lt; / Cfquery & gt;
Try it out:
& lf; Cffile action = "read" file = "mypath / myFile.sql" variable = "sp_1" & gt; & Lt; Cfstoredproc process = "sp_executesql" data source = "#end (data #) #" & gt; & Lt; Cfprocparam type = "in" cfsqltype = "cf_sql_varchar" value = '# protectedquilites (sp_1) #' & gt; & Lt; / Cfstoredproc & gt;
Coldfusion avoids your single quote in DB variables.
Edit:
Second, the statements are batching; the drive will batch your query as a single statement, the keyword "ge" is a batch indicator that has been prepared . In other words, your "Geo" is actually a problem
To fix this, you will need to run 2 questions - why to make one drop and make another? Because in any batch actually make the first statement. In the msssx studio, using geo, you are creating 3 batches, now you have to find out how to use one.
The good news is that your ANSI is not required for the empty and quoted identifier - they are the default on most instances
Is this help?
Comments
Post a Comment