>You can use the Execute command. Try this code in the Query Analyzer:
>
>Declare @cString As Char(100)
>Set @cString = "Use Northwind"
>Execute(@cString)
>
>In your case, it is very simple to qualify the database. For example, to fully reference the customers table in the Northwind database:
>
>northwind.dbo.customers
>
>The following code will work:
>
>Declare @String As char(100)
>Set @string = "Select * From northwind.dbo.customers"
>Execute(@string)
>
>
>
>HTH
I was close... I had all but the extra parentheis around execute...
One other thing, what is the limit on dynamic SQL execution... I tried creating a default char string as 500 and it gave an error...
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement