synchronize script can't handle function dependencies
bjarni
Posts: 5
The synchronize script made by SqlCompare8 has (among alot of other things) two table-valued function:
CREATE dbo.FUNCTION1()
RETURNS TABLE
AS
RETURN (
SELECT ... FROM dbo.FUNCTION2()
INNER JOIN ...something...
)
CREATE dbo.FUNCTION2()
RETURNS @abc TABLE
(
...some table elements
)
AS
BEGIN
INSERT INTO @abc
SELECT .... FROM TABLE WHERE...
END
My problem is that the script fails (Invalid object name 'dbo.FUNCTION2') because FUNCTION2 is specified AFTER FUNCTION1 in the script generated by SqlCompare8.
I have tried to use /option:IncludeDependencies without any success.
Is there anyway to force SqlCompare to handle the case correctly?
CREATE dbo.FUNCTION1()
RETURNS TABLE
AS
RETURN (
SELECT ... FROM dbo.FUNCTION2()
INNER JOIN ...something...
)
CREATE dbo.FUNCTION2()
RETURNS @abc TABLE
(
...some table elements
)
AS
BEGIN
INSERT INTO @abc
SELECT .... FROM TABLE WHERE...
END
My problem is that the script fails (Invalid object name 'dbo.FUNCTION2') because FUNCTION2 is specified AFTER FUNCTION1 in the script generated by SqlCompare8.
I have tried to use /option:IncludeDependencies without any success.
Is there anyway to force SqlCompare to handle the case correctly?
Comments
I updated the database by running all the other part of the scriptfile. So now it's only FUNCTION1 and FUNCTION2 that differs. But I still get an illegal scriptfile.
It works fine if I change the name (DROP/CREATE) of FUNCTION2.
If I change it back it doesn't work
I have tried several different names - and all (but the one I want) works fine???
PS. We have earlier had problems with illegal denpendencies in our scriptfiles generated by SqlCompare. It slows our update procedure down, when we have to modify the script manually each time.
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569