Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating Extended properties
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00688296
Message ID:
00688323
Vues:
16
You've to double single quotes inside string literal
strDetail = CHRTRAN(strDetail, ['], [''])
* Now your string looks like this
'Here is an ''example'' of what I mean'
>Hi,
>
>I have the following code to update an extended property:
>
>
>Dim cmdUpdateProp As New ADODB.Command
>Dim strSQL As String
>
>With cmdUpdateProp
>  .ActiveConnection = mconnDatabase
>  .CommandTimeout = 60
>  .CommandType = adCmdText
>End With
>
>strSQL = "EXEC sp_updateextendedproperty 'lds_Comment', '" & strDetail
> & "', 'user', dbo, 'table', '" & mstrTable & "', null, null"
>
>cmdUpdateProp.CommandText = strSQL
>cmdUpdateProp.Execute
>
>
>
>The code works fine except when strDetail contains an apostrophe. For example, if strDetail contains ...
>
>
>
> "Here is an 'example' of what I mean".
>
>
>
>Short of removing the apostrophe characters, what is the best way to handle this?
>
>I realize I could do it this way, but I'd have the same problem if the string contained a "#" ...
>
>
>
>strSQL = "EXEC sp_updateextendedproperty 'lds_Comment', #" & strDetail
> & "#, 'user', dbo, 'table', #" & mstrTable & "#, null, null"
>
>
>
>
>Al
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform