Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Correct Syntax to build a formatted string

Author  Topic 

Plotin
Starting Member

21 Posts

Posted - 2003-09-25 : 10:58:13
Hi
I am trying to build a string kind like the following
Function Main(rstFields)
Main = True
End Function

Tried the following syntax using a varchar variable
Declare @string varchar(50)
Set @string = 'Function Main(rstFields)' + Char(13) + 'Main = True' + Char(13) + 'End Function'

The result was
Function Main(rstFields)� Main = True� End Function

Thanks for your help

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-09-25 : 11:01:57
HUH ?????

don't know if this helps, but a newline is a combination of a carrage return (CHAR(13)) and a linefeed (CHAR(10)).

edit: oops, had them backwards ...

- Jeff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-09-25 : 12:20:44
It also depends on what editor you are using. For Query Analyzer, you'll need both as Jeff mentioned.

But why are you building code inside T-SQL code?

Tara
Go to Top of Page

Plotin
Starting Member

21 Posts

Posted - 2003-09-26 : 20:00:54
Thanks
It works

PS:The reason I am writing code within T-SQL is because an application receives VBScript code snippets from a SQL database

Go to Top of Page
   

- Advertisement -