I think that is the most elegant way.
Erwin Sloboda
Database Specialist, Database Services Group
Assante Advisory Services Ltd.
416-535-3792, 416-569-7089
Toronto, ON
-----Original Message-----
From: [Email Address Removed] [mailto:[Email Address Removed]
Sent: Thursday, December 18, 2003 11:09 AM
To: LazyDBA.com Discussion
Subject: Re: Help concatenating non string fields
What are the datatypes for Dbo.ID and dbo.ReportsId ?
I'm sure there's a more elegant way of doing this, but this seems to work
for starters:
declare @Num1 int
declare @Num2 int
Set @Num1 = 300
Set @Num2 = 5
select cast(cast(@num1 as varchar(3)) + cast(@num2 as varchar(3)) as
int)
hth,
JJMontgomery
"Justin Gilli"
<[Email Address Removed]
.com> To
"LazyDBA.com Discussion"
12/18/2003 09:38 <[Email Address Removed]
AM cc
Subject
Help concatenating non string
fields
I am trying to concat two non sting fields.
For example :
(Dbo.Id) +''+(dbo.ReportsId)
300 5 = 3005
but I am getting the addition of these two (305) instead of them being
appended to each other(3005).
I have tried Cast and converting the values from int to varchar but it
still adds them.
Any advice?
Sincerely,
Justin Gilli
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] All e-mail to or from this address is recorded by Assante
and is subject to archival, monitoring and/or review, by and/or disclosure
to, someone other than the recipient. This message is intended only for
the persons to whom it is addressed. It may contain information that is
privileged and confidential. If you are not the intended recipient, please
contact the sender immediately and delete the e-mail without reading it
or making a copy.
Any distribution, copying, or other use of this e-mail by
a person other than the intended recipient is prohibited. Precautions have
been taken to screen this e-mail for viruses but it may not be virus free.
We are not responsible for any damage that may be caused by this
e-mail. This communication is for information purposes only and is not
an offer to sell or a solicitation of an offer to buy any financial product,
an official confirmation of any transaction or an official statement of
Assante. E-mail transmission cannot be guaranteed to be secure or
error-free.
--------------------------------------------------------------------------
MS Sql Server LazyDBA home page