|
shobhaaradhya
Starting Member
35 Posts |
Posted - 10/19/2012 : 06:24:31
|
Hi,
I am facing serious issue in one of the script which is causing problem in subscribing the db.
The function is as below.
create FUNCTION [dbo].[Fn_Get_Names] ( @Data1 decimal(18,9), @Data2 decimal(18,9), @Data3 bigint ) RETURNS @tmptbl TABLE ( v_rec1 decimal(18,9), v_rec2 decimal(18,9), v_rec3 decimal(18,9), v_rec4 AS (ISNULL(CONVERT(decimal(18,9),(v_rec2+v_rec3-v_rec1)),0)) ) AS
BEGIN
DECLARE @Debug bit SET @debug = 0
DECLARE d_rec1 decimal(18,9) DECLARE d_rec2 decimal(18,9) DECLARE d_rec3 decimal(18,9)
---------------------------------------- code for some calculation here
----------------------------------------
INSERT INTO @tmptbl ( v_rec1, v_rec2, v_rec3 ) VALUES ( d_rec1, d_rec2, d_rec3 ) RETURN END
Below is the error details
The schema script '\\SERVER1\C$\Program Files (x86)\Microsoft SQL Server\MSSQL$DEVELOPMENT\ReplData\ftp\SERVER1$DEV_EMPLOYEE_PubEmp\20121019095745\Fn_Get_Currency_Values_2793.sch' could not be propagated to the subscriber.
The schema script '\\SERVER1\C$\Program Files (x86)\Microsoft SQL Server\MSSQL$DEVELOPMENT\ReplData\ftp\SERVER1$DEV_EMPLOYEE_PubEmp\20121019095745\Fn_Get_Names_2793.sch' could not be propagated to the subscriber. (Source: Merge Replication Provider (Agent); Error number: -2147201001) --------------------------------------------------------------------------------------------------------------- Extracted file 'Fn_Get_Names_2793.sch' (Source: TESTSRV\TKT (Agent); Error number: 20151) --------------------------------------------------------------------------------------------------------------- Line 1: Incorrect syntax near 'isnull'.
If I remove (ISNULL(CONVERT(decimal(18,9),(v_rec2+v_rec3-v_rec1)),0)) from the table declaration it works fine, else the subscription shows the above error.
Is there any workaround for this or any other way to rewrite this script?
Thanks in advance,
|
|