[thelist] SQL/ASP Rename or Copy Table?

Scott Dexter sgd at ti3.com
Tue Oct 10 17:48:09 CDT 2000


> of course, you have to know how to call a stored proc from 
> your script 
> (sorry, i don't know ASP)
> 

this is cake. The short answer, use the Execute method of the Connection
object, and your SQL statement begins with "Exec" -- oConn.Execute "Exec
sp_storedProc"  --The MS docs would have you believe a convoluted Connection
object is the way to go, but its ugly, and only useful under a very narrow
set of circumstances.

and a long winded, all inclusive example:

<%
Set oConn = SetupSQL("DSN=SQLServer;UID=dbouser;PWD=foopwd")
sqlstr = "Exec sp_rename 'tboldtable', 'tbnewtable'"
oConn.Execute sqlstr
oConn.Close
Set oConn=Nothing


Function SetupSQL(byval connstr)
Dim DBCON
Set DBCON = Server.CreateObject("ADODB.Connection")
DBCON.ConnectionTimeout = 15
DBCON.CommandTimeout = 60
DBCON.Open connstr
Set SetupSQL = DBCON
Set DBCON = Nothing
End Function
%>

sgd
--
work: http://www.ti3.com/
non: http://thinksafely.org/




More information about the thelist mailing list