How can I convert a string with control characters to one in
DieterS
Posts: 4
I have functions that let me create this string:
But how do I get this executable SQL script from it without saving it as a file?
I guess that Redgate has a converter. But can not find him.
vbCrLf & "-- ### HEADER END ###" & vbCrLf & "BEGIN TRANSACTION" & vbCrLf & "SET IDENTITY_INSERT [dbo].[WidgetDescriptions_II] ON " & vbCrLf & "GO" & vbCrLf & vbCrLf & vbCrLf & "Update [dbo].[WidgetDescriptions_II] SET ShortDescription = 'DSA_A widget' , Description = '<description xmlns=""http://www.red-gate.com/widgets/WidgetDescriptionSCHEma"">" & vbCrLf & " <descriptiveText>A widget</descriptiveText>" & vbCrLf & " <manufacturer>Acme Incorporated</manufacturer>" & vbCrLf & " <countryOfOrigin>United Kingdom</countryOfOrigin>" & vbCrLf & " <size length=""12"" width=""5"" height=""7"" />" & vbCrLf & "</description>' , Picture = 0x717370565797219021 WHERE WidgetID = 1 " & vbCrLf & "GO " & vbCrLf & "If @@ERROR <> 0 SET NOEXEC ON " & vbCrLf & "GO" & vbCrLf
But how do I get this executable SQL script from it without saving it as a file?
-- ### HEADER END ### BEGIN TRANSACTION SET IDENTITY_INSERT [dbo].[WidgetDescriptions_II] ON GO Update [dbo].[WidgetDescriptions_II] SET ShortDescription = 'DSA_A widget' , Description = '<description xmlns="http://www.red-gate.com/widgets/WidgetDescriptionSCHEma"> <descriptiveText>A widget</descriptiveText> <manufacturer>Acme Incorporated</manufacturer> <countryOfOrigin>United Kingdom</countryOfOrigin> <size length="12" width="5" height="7" /> </description>' , Picture = 0x717370565797219021 WHERE WidgetID = 1 GO If @@ERROR <> 0 SET NOEXEC ON GO
I guess that Redgate has a converter. But can not find him.
Comments
This doesn't really look like a SQL Comparison SDK question. It seems to me like your script is already stored in the desired format within the string. I'm not really sure what you want to do - is it that you want to execute the script? If so then you'll probably want to use the SqlCommand class within the .NET framework. See the MSDN documentation for more info - https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
Redgate Software