September 7, 2017 at 8:00 am
Hi
I am doing replication in SQL server 2014
While pushing data from subscriber i am getting this error
Incorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax. (Source: MSSQLServer, Error number: 1018)
And i checked out my SQL code where it occured.
my code is given below
please help me to sort out this problem
BEGIN
DECLARE
@intResult INTEGER
-- Always start with the default value
SELECT @intResult = @intDefaultValue
-- When the input is not null and is a number
IF @strToConvert IS NOT NULL
AND ISNUMERIC( @strToConvert ) = 1
BEGIN
-- Truncate the decimal portion?
IF CHARINDEX( '.', @strToConvert ) > 0
AND @blnTruncateDecimalPlaces = 1
SELECT @strToConvert = LEFT( @strToConvert, CHARINDEX( '.', @strToConvert ) -1 )
-- Space characters are not significant
SELECT @strToConvert = LTRIM( RTRIM( @strToConvert ) )
-- Check the specified length is not exceeded
IF CHARINDEX( '.', @strToConvert ) = 0
AND LEN( @strToConvert ) <= @intMaximumDigits
SELECT @intResult = CAST( @strToConvert AS INTEGER )
END
-- Yield the result to the caller
RETURN @intResult
END
September 7, 2017 at 8:10 am
rishidinesh942 - Thursday, September 7, 2017 8:00 AMHi
I am doing replication in SQL server 2014
While pushing data from subscriber i am getting this errorIncorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax. (Source: MSSQLServer, Error number: 1018)
And i checked out my SQL code where it occured.
my code is given below
please help me to sort out this problemBEGIN
DECLARE
@intResult INTEGER
-- Always start with the default value
SELECT @intResult = @intDefaultValue
-- When the input is not null and is a number
IF @strToConvert IS NOT NULL
AND ISNUMERIC( @strToConvert ) = 1
BEGIN
-- Truncate the decimal portion?
IF CHARINDEX( '.', @strToConvert ) > 0
AND @blnTruncateDecimalPlaces = 1
SELECT @strToConvert = LEFT( @strToConvert, CHARINDEX( '.', @strToConvert ) -1 )
-- Space characters are not significant
SELECT @strToConvert = LTRIM( RTRIM( @strToConvert ) )
-- Check the specified length is not exceeded
IF CHARINDEX( '.', @strToConvert ) = 0
AND LEN( @strToConvert ) <= @intMaximumDigits
SELECT @intResult = CAST( @strToConvert AS INTEGER )
END
-- Yield the result to the caller
RETURN @intResult
END
I do not think that this code could generate the error you are seeing. The message suggests that you are using query hints in your code – and there are none in the code provided.
September 7, 2017 at 8:16 am
Phil Parkin - Thursday, September 7, 2017 8:10 AMrishidinesh942 - Thursday, September 7, 2017 8:00 AMHi
I am doing replication in SQL server 2014
While pushing data from subscriber i am getting this errorIncorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax. (Source: MSSQLServer, Error number: 1018)
And i checked out my SQL code where it occured.
my code is given below
please help me to sort out this problemBEGIN
DECLARE
@intResult INTEGER
-- Always start with the default value
SELECT @intResult = @intDefaultValue
-- When the input is not null and is a number
IF @strToConvert IS NOT NULL
AND ISNUMERIC( @strToConvert ) = 1
BEGIN
-- Truncate the decimal portion?
IF CHARINDEX( '.', @strToConvert ) > 0
AND @blnTruncateDecimalPlaces = 1
SELECT @strToConvert = LEFT( @strToConvert, CHARINDEX( '.', @strToConvert ) -1 )
-- Space characters are not significant
SELECT @strToConvert = LTRIM( RTRIM( @strToConvert ) )
-- Check the specified length is not exceeded
IF CHARINDEX( '.', @strToConvert ) = 0
AND LEN( @strToConvert ) <= @intMaximumDigits
SELECT @intResult = CAST( @strToConvert AS INTEGER )
END
-- Yield the result to the caller
RETURN @intResult
ENDI do not think that this code could generate the error you are seeing. The message suggests that you are using query hints in your code – and there are none in the code provided.
Ok
Is there any thing went wrong while replication
September 7, 2017 at 8:23 am
rishidinesh942 - Thursday, September 7, 2017 8:16 AMOk
Is there any thing went wrong while replication
I thought that a replication error was the reason you asked the question?
September 7, 2017 at 8:32 am
Phil Parkin - Thursday, September 7, 2017 8:23 AMrishidinesh942 - Thursday, September 7, 2017 8:16 AMOk
Is there any thing went wrong while replicationI thought that a replication error was the reason you asked the question?
yep
September 7, 2017 at 8:34 am
rishidinesh942 - Thursday, September 7, 2017 8:32 AMPhil Parkin - Thursday, September 7, 2017 8:23 AMrishidinesh942 - Thursday, September 7, 2017 8:16 AMOk
Is there any thing went wrong while replicationI thought that a replication error was the reason you asked the question?
yep
This is the detailed error i got ..
CREATE PROCEDURE [dbo].[spCD_GetFundTxnHistory]
@FundCode varchar(10),
@FromDate datetime
AS
If @FromDate Is Null SELECT @FromDate = Min(FundTxn_dtmCommitted) FROM tblFund_Transaction
SELECT FT.FundTxn_dtmCommitted,
FT.FundTxn_strCode,
FT.FundTxn_intSequence,
FT.FundTxn_curValue,
FT.FundTxn_intQty,
FTT.TxnType_strName,
FTT.TxnType_strRevExp,
FTT.TxnType_strDescription,
FT.FundTxn_strNote,
'' AS AssocFu
(Transaction sequence number: 0x0014CFF600000E8000F900000000, Command ID: 3308)
Error messages:
Incorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax. (Source: MSSQLServer, Error number: 1018)
Get help: http://help/1018
Incorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax. (Source: MSSQLServer, Error number: 1018)
Get help: http://help/1018
Incorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax. (Source: MSSQLServer, Error number: 1018)
Get help: http://help/1018
September 7, 2017 at 8:43 am
Please post all SQL code for procedure dbo.spCD_GetFundTxnHistory.
September 7, 2017 at 8:53 am
Phil Parkin - Thursday, September 7, 2017 8:43 AMPlease post all SQL code for procedure dbo.spCD_GetFundTxnHistory.
Here it is
AS
If @FromDate Is Null SELECT @FromDate = Min(FundTxn_dtmCommitted) FROM tblFund_Transaction
SELECT FT.FundTxn_dtmCommitted,
FT.FundTxn_strCode,
FT.FundTxn_intSequence,
FT.FundTxn_curValue,
FT.FundTxn_intQty,
FTT.TxnType_strName,
FTT.TxnType_strRevExp,
FTT.TxnType_strDescription,
FT.FundTxn_strNote,
'' AS AssocFundName,
CASE PA.POSA_strAdjustType
WHEN 'A' THEN 'O' --Adds or increases
WHEN 'O' THEN 'O' --Opening Balances
WHEN 'S' THEN 'I' --Subtracts or drops
WHEN 'D' THEN 'I' --POS Drops
WHEN 'I' THEN 'O' --POS Increases - shldnt be seen in FundTxn tables
END AS AssocFITDir,
P.POSS_strUserName AS AssocFITUserName,
PT.PayType_strDescription,
FT.AssocFund_strCode,
FT.POSS_intPOSSessionNumber,
FT.POSA_dtmAdjustmentDateTime,
FT.Deposit_intId
FROM tblFund_Transaction FT (INDEX = indFundTxn_DateCommitted)
INNER JOIN tblFundTxn_Type FTT
ON FT.TxnType_strCode = FTT.TxnType_strCode
LEFT JOIN tblPaymentType PT
ON PT.PayType_strType = FT.PayType_strType
LEFT JOIN tblPOS_SessAdjusts PA
ON FT.POSS_intPOSSessionNumber = PA.POSS_intPOSSessionNumber
AND FT.POSA_dtmAdjustmentDateTime = PA.POSA_dtmAdjustmentDateTime
LEFT JOIN tblPOS_Sess P
ON P.POSS_intPOSSessionNumber = PA.POSS_intPOSSessionNumber
WHERE FT.FundTarget_strCode = @FundCode
AND FT.FundTxn_dtmCommitted >= @FromDate
AND Not FT.POSS_intPOSSessionNumber Is Null
UNION ALL
SELECT FT.FundTxn_dtmCommitted,
FT.FundTxn_strCode,
FT.FundTxn_intSequence,
FT.FundTxn_curValue,
FT.FundTxn_intQty,
FTT.TxnType_strName,
FTT.TxnType_strRevExp,
FTT.TxnType_strDescription,
FT.FundTxn_strNote,
F.Fund_strName AS AssocFundName,
'' As AssocFITDir,
'' AS AssocFITUserName,
PT.PayType_strDescription,
FT.AssocFund_strCode,
FT.POSS_intPOSSessionNumber,
FT.POSA_dtmAdjustmentDateTime,
FT.Deposit_intId
FROM tblFund_Transaction FT (INDEX = indFundTxn_DateCommitted)
INNER JOIN tblFundTxn_Type FTT
ON FT.TxnType_strCode = FTT.TxnType_strCode
LEFT JOIN tblPaymentType PT
ON PT.PayType_strType = FT.PayType_strType
LEFT JOIN tblFund F
ON FT.AssocFund_strCode = F.Fund_strCode
WHERE FT.FundTarget_strCode = @FundCode
AND FT.FundTxn_dtmCommitted >= @FromDate
AND (
Not AssocFund_strCode Is Null
OR (IsNull(AssocFund_strCode,'') = '' AND IsNull(FT.POSS_intPOSSessionNumber,'') = '')
)
ORDER BY FT.FundTxn_dtmCommitted DESC,
FT.FundTxn_strCode, FT.FundTxn_intSequence
September 7, 2017 at 9:04 am
FROM tblFund_Transaction FT (INDEX = indFundTxn_DateCommitted)
In both places where that appears, you need a WITH added (or, probably better to take the index hint out)
FROM tblFund_Transaction FT WITH (INDEX = indFundTxn_DateCommitted)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 7, 2017 at 9:17 am
FROM tblFund_Transaction FT (INDEX = indFundTxn_DateCommitted)
In both places where that appears, you need a WITH added (or, probably better
FROM tblFund_Transaction FT WITH (INDEX = indFundTxn_DateCommitted
September 7, 2017 at 9:18 am
GilaMonster - Thursday, September 7, 2017 9:04 AMFROM tblFund_Transaction FT (INDEX = indFundTxn_DateCommitted)
In both places where that appears, you need a WITH added (or, probably better
FROM tblFund_Transaction FT WITH (INDEX = indFundTxn_DateCommitted
Thank you Its Really helpfull
Viewing 11 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply