Results 1 to 6 of 6

Thread: Getting "Error 156" while execution of query

  1. #1
    Join Date
    Dec 2009
    Posts
    38

    Getting "Error 156" while execution of query

    Hello friends,

    I am getting frustrated because of one SQL error while execution of query. I am trying to run following query:
    SELECT bookNo, BookName, BookPrice FROM
    BookDemo WHER bookNo='003'
    Whenever I try to execute this query I get 'Error 156' telling "Incorrect syntax near the keyword '%.*ls'". I am not getting what's wrong with this query. Please help to sort out this SQL error. I would appreciate you help.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Getting "Error 156" while execution of query

    "Error 156" tells that the syntax of a SQL statement is invalid and which detects the syntax error near the keyword specified in the error message. One of the more complicated causes for this error may be a compatibility level mismatch for the current database. The most frequent causes for syntax errors are misspellings of Transact-SQL keywords or operators, and specifying the syntax of a Transact-SQL statement in the wrong order.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Getting "Error 156" while execution of query

    Hi friend,

    This 'Error 156' error occurs only when you use incorrect syntax in SQL query. The which you have mentioned contains one syntax error near "WHERE" clause. You need to make changes in this clause to avoid this error. You have written "WHERE" clause as "WHER", i.e one character is missing from this clause and which makes it invalid. I suggest you to try following query:
    SELECT bookNo, BookName, BookPrice FROM
    BookDemo WHERE bookNo='003'

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Getting "Error 156" while execution of query

    Hi,

    I recommend you to check the Transact-SQL statement syntax. You should also reexamine the entire SQL query statement that causes the error. As SQL query syntax may be very complex, SQL Server may incorrectly report the position of the syntax error as later in the Transact-SQL statement than it actually occurred. Second, Verify the syntax order of the statement. I hope this may solve you problem.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Getting "Error 156" while execution of query

    Hello friend,

    I suggest you to do following things to troubleshoot "Error 156":
    • Check the name of the column are correct.
    • Make sure that the you are suing correct syntax of the "SQL" clause.
    • Check the table name as well as the condition term.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Getting "Error 156" while execution of query

    One of the more complicated causes for 'Error 156' error may be a compatibility level mismatch for the current database. This error indicates that the syntax of a Transact-SQL statement is incorrect and that the syntax error was detected near the keyword specified in the error message. The most frequent causes for syntax errors are misspellings of Transact-SQL keywords or operators, and specifying the syntax of a Transact-SQL statement in the wrong order.

Similar Threads

  1. Replies: 3
    Last Post: 10-01-2014, 10:40 AM
  2. Replies: 4
    Last Post: 07-02-2011, 06:53 AM
  3. Microsoft Live Meeting Error "Data Execution Prevention"
    By Marcya in forum Technology & Internet
    Replies: 5
    Last Post: 05-01-2010, 05:29 AM
  4. Iphone Error "Main Script Execution Failed"
    By kamina23 in forum Portable Devices
    Replies: 2
    Last Post: 26-08-2009, 11:44 PM
  5. Replies: 1
    Last Post: 07-09-2007, 10:46 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,175,908.03882 seconds with 16 queries