Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009
    Posts
    28

    Unanswered: T-SQL Statement Error

    Hello Experts,

    Im trying to write a simple T-SQL statement but having error which Im not able to understand at all. SQL is keep complying and saying
    ---------------------------------------------------------
    Msg 102, Level 15, State 1, Line 1
    Incorrect syntax near ','.
    ---------------------------------------------------------

    Here is my code
    -----------------------------------------------------
    declare @AD_TransactionErrorAuditID varchar(30),
    @AD_TransactionErrorAuditSeqNum varchar(30),
    @AD_ErrorCode varchar(10),
    @AD_ErrorMessage varchar(40),
    @AD_Fetch_Data varchar(250)
    select @AD_TransactionErrorAuditID = 'TransactionErrorAuditID'
    select @AD_TransactionErrorAuditSeqNum = 'TransactionErrorAuditSequentialNumber'
    select @AD_ErrorCode = 'ErrorCode'
    select @AD_ErrorMessage = 'ErrorMessage'
    select @AD_Fetch_Data = +@AD_TransactionErrorAuditID+ ', '
    +@AD_TransactionErrorAuditSeqNum+ ', '
    +@AD_ErrorCode+ ', '
    +@AD_ErrorMessage
    EXEC (@AD_Fetch_Data)
    GO
    ----------------------------------------------------

    Can anybody see what am I doing wrong?

    Thanks a lot in advance.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    You just accidentally the whole batch.

    seriously, though, what are you executing?

  3. #3
    Join Date
    Oct 2009
    Posts
    28
    Don't worry I got it wroking fine by just changing the field on 1 variable. This what am I trying to do and you've find out. Good Luck and here is code for reference.

    declare @AD_TransactionErrorAuditID varchar(30),
    @AD_TransactionErrorAuditSeqNum varchar(40),
    @AD_ErrorCode varchar(10),
    @AD_ErrorMessage varchar(40),
    @AD_Fetch_Data varchar(250)
    select @AD_TransactionErrorAuditID = 'TransactionErrorAuditID'
    select @AD_TransactionErrorAuditSeqNum = 'TransactionErrorAuditSequentialNumber'
    select @AD_ErrorCode = 'ErrorCode'
    select @AD_ErrorMessage = 'ErrorMessage'
    select @AD_Fetch_Data = +@AD_TransactionErrorAuditID+ ', '
    +@AD_TransactionErrorAuditSeqNum+ ', '
    +@AD_ErrorCode+ ', '
    +@AD_ErrorMessage
    EXEC (@AD_Fetch_Data)
    GO

    OH YA!!! IT DOES EXECUTE.

Posting Permissions

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