Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro substituion
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00840471
Message ID:
00889618
Vues:
24
>>
>>You can build SQL statement as a local string variable and than run it using EXECUTE command or sp_executesq system sproc. For example,
DECLARE @Sql varchar(4000)
>>SET @Sql = 'SELECT fld1 FROM [' +  @lcTableName + ']'
>>EXECUTE (@Sql)
>
>How are you able to use '[' and ']' w/o getting an error?

Why would I get an error? The square brackets are legitimate delimiters for SQL Server identifiers. The double quotes can also be used if SET QUOTED_IDENTIFIER is set to ON. See BOL for details.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform