Data Types

  • SQL Server 2000 sp3a

    Having problems with an application hitting on of our SQL Server Databases  and I'm looking at the data to try and figure out why users are getting booted.

    The only 'wierd' thing I can see so far is a '-1' value in a column that is setup as a 'char' type column.    is -1 allowed here?

  • Should be allowed unless the length of column is set to 1 ???? What other data do you have and what kind of error msg do the users get ?







    **ASCII stupid question, get a stupid ANSI !!!**

  • The field length is set to 3 - so that's not the problem.   The users are getting booted from the application.    I'm just doing some poking around before I call the Vendor (it's a canned app) and I wasn't sure about whether or not the '-1' was allowed in a char field.   Thanks  : )

  • Yes, -1 can be placed in a char field.

  • CREATE TABLE tblFoo (dummycol char(3) NOT NULL)

    INSERT tblFoo VALUES (-1)

    SELECT dummycol, LEFT(dummycol, 1), SUBSTRING (dummycol, 2, 1) FROM tblFoo

    gives

    dummycol          

    -------- ---- ----

    -1       -    1

    It's the string "-1" not the number -1

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply