sql server - How can I, in Classic ASP/VBScript, get the value of a variable set with SET @local_variable? -
I have a table with a type of area that is being populated to call.
What I would like to do is get back the GUID back which was created immediately after writing a record in the table.
If I run some SQL like the following from SQL Management Studio, then helpful, prints the value of my GUID
Announcement @ Jewish Unique Identifier; SET @GUID = NEWID (); Choose GUIDE; My question is, how can I get the value of @GUID from classic ASP using VBScript? I tried it
& lt;% conn.open application ("connection string") sql = "DECLARE @GUID uniqueidentifier; SET @GUID = NEWID (); Select GUID; set res = conn.execute (sql) response.write res.fields.count response.write res ("guid")%> but It does not seem to work: res does not contain any fields in the object, so the guid field is trying to read the errors. I get an error in item "
It seems that You have simplified your query as the snippet has been shown.
However, if you are running a stored proc or multi-statement query, conn.execute can render several redesets, which can be used until you reach the previous one.
Comments
Post a Comment