Home All Groups Group Topic Archive Search About

Convert Int to String and add to another String

Author
23 Mar 2006 3:33 AM
Vear
Hi,

I have a SP where I grab a value from an Identity field and then I want to
convert it to a String and add it to another string.

Only the @lname stores in the @CustNum. From what I understand STR should
change it to a string. Any help would be great.

Here is the example

Declare @lname varchar(10)
Declare @lnameid int
declare @CustNum varchar(15)

    INSERT INTO ClientGenerator(ClientCode) VALUES (@Lname + @Fname)
    SELECT @lnameid=SCOPE_IDENTITY()

    Set @CustNum = @lname + STR(@lnameid)

Author
23 Mar 2006 6:20 AM
Uri Dimant
Take a look at CAST,CONVERT  system functions in the BOL

Show quote
"Vear" <V***@discussions.microsoft.com> wrote in message
news:EDEDC80E-A41E-4DA0-953C-0E4A61F198CB@microsoft.com...
> Hi,
>
> I have a SP where I grab a value from an Identity field and then I want to
> convert it to a String and add it to another string.
>
> Only the @lname stores in the @CustNum. From what I understand STR should
> change it to a string. Any help would be great.
>
> Here is the example
>
> Declare @lname varchar(10)
> Declare @lnameid int
> declare @CustNum varchar(15)
>
> INSERT INTO ClientGenerator(ClientCode) VALUES (@Lname + @Fname)
> SELECT @lnameid=SCOPE_IDENTITY()
>
> Set @CustNum = @lname + STR(@lnameid)
Author
23 Mar 2006 2:13 PM
Vear
Thanks, Cast worked Great!!

Show quote
"Uri Dimant" wrote:

> Take a look at CAST,CONVERT  system functions in the BOL
>
> "Vear" <V***@discussions.microsoft.com> wrote in message
> news:EDEDC80E-A41E-4DA0-953C-0E4A61F198CB@microsoft.com...
> > Hi,
> >
> > I have a SP where I grab a value from an Identity field and then I want to
> > convert it to a String and add it to another string.
> >
> > Only the @lname stores in the @CustNum. From what I understand STR should
> > change it to a string. Any help would be great.
> >
> > Here is the example
> >
> > Declare @lname varchar(10)
> > Declare @lnameid int
> > declare @CustNum varchar(15)
> >
> > INSERT INTO ClientGenerator(ClientCode) VALUES (@Lname + @Fname)
> > SELECT @lnameid=SCOPE_IDENTITY()
> >
> > Set @CustNum = @lname + STR(@lnameid)
>
>
>

AddThis Social Bookmark Button