Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is this possible ??

Status
Not open for further replies.

geffry

Programmer
Jun 26, 2002
33
US
I need to print a message from isql.

print 'Text is ' + @name

I need to print my string and the value of the variable @name in the same line.

print 'Text is'
print @name

If i do like this a new line appears, Can i combine the above two prints to get the ouput in a single line.

thanks

 
Hi geff,

It is quite possible. Try this.

isql -U xyz -P abc -S lkj -D mno << EOF
declare @name char(20)
select @name = 'geffry'
exec(&quot;print 'Text is &quot; + @name + &quot;'&quot;)
go
EOF

Note the space included in the string &quot;print 'Text is &quot; at the end. This is to avoid from the @name getting concatenated with 'Text is' without any space.


Vijay
 
I couldn't get ViJay's code to work.
I could get this to run OK though:-
isql -U ucontrol -P pcontrol << EOF
declare @name char(20)
declare @printline char(120)
select @name = 'geffry'
select @printline = 'Text is ' + @name
print @printline
go
EOF

HTH ((;-))) Dickie Bird
Honi soit qui mal y pense
 

I don't understand what problem dickie had in executing the code supplied earlier. The basic idea was to avoid declaration of more variables.

Vijay
 
Estimado amigo, espero haberte entendido la idea, si no esto disculpas.

declare @name char(20)
select @name=&quot;Carlos &quot;

print &quot;text is, %1!&quot;, @name


Atte.
cballada
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top