Results 1 to 2 of 2

Thread: varchar variables

  1. #1
    MMS Guest

    varchar variables

    Hi,

    Declare @ii varcahr(2)
    Select @ii = 2

    when I execute the above SQl statement, it returns error in SQL 6.5.
    Doesn't seem to be same in SQL7.0

    Someone, Pls help

    thanks



  2. #2
    Andrew Wiegand Guest

    varchar variables (reply)

    Hi,
    I believe SQL Server 7 implicitely converts a variable with a datatype of 'int' to a datatype of 'varchar'. In SQL Server 6.5 you were required to use explicit conversion via the Convert function. In order for the below sql to execute successfully in 6.5 you would change it to:
    Declare @ii varchar(2)
    Select @ii = convert(varchar,2)

    andrew

    ------------
    MMS at 9/5/99 10:29:10 PM

    Hi,

    Declare @ii varcahr(2)
    Select @ii = 2

    when I execute the above SQl statement, it returns error in SQL 6.5.
    Doesn't seem to be same in SQL7.0

    Someone, Pls help

    thanks



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •