Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    AUS
    Posts
    26

    Unanswered: error : Only constants, constant expressions, or variables allowed here.

    hi all,
    when I try to do the following insert for the table test

    create table test (outputs character(10), chk integer)

    insert into test values('a',((select count(*) from test where outputs='a')+1))

    I am getting the error
    The name 'outputs' is illegal in this context. Only constants, constant expressions, or variables allowed here. Column names are illegal.

    when i tried the same in DB2 it's working fine. is there anyerror in my syntax or this kind of function not allowed in SQL Server.

    regards
    Melb

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Use a SELECT instead of the VALUES clause.

    -PatP

Posting Permissions

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