View Full Version : SQL Query Syntax

12-20-2011, 04:20 PM
I can write SQL queries in ASP no problem but I have one that I need to run within Enterprise Manager as it will timeout if I call it from an ASP. Can someone help me with the syntax?

dim strUserName

strUserName = "isisTraffic" then
szStatement = "execute dbo.ap_DeleteDynamicResource '" + strUserName + "'"
set conn = createobject("ADODB.Connection")
conn.provider = "sqloledb"
conn.connectionstring = "data source="& DB &";uid="& UID &";pwd="& PWD &";initial catalog=site_security"
set conn = nothing

Is this just as simple as typing in the following? I am guessing I may need single or double quotes around the UserName but not quite sure.
execute dbo.ap_DeleteDynamicResource strUserName

Old Pedant
12-20-2011, 10:04 PM
Yes, you need the apostrophes around the user name.

If the user name itself contains an apostrophe, you need to double it.


execute dbo.ap_DeleteDynamicResource 'O''Brien'

By the way, it would be easy to change the timeout in the ASP code to a larger value.

12-21-2011, 05:44 AM
Perfect, worked as expected. Thank you very much! Normally increasing the timeout for the ASP would have been easy enough but because of the security layer that the responses go through and the timeout values within that layer in addition to IIS this wasnt a feasible option.