Issue - system_user becomes system_user() which is incorrect

tranquilizertranquilizer Posts: 3
edited January 21, 2013 3:18PM in SQL Compare Previous Versions
I have a table creation script within which there is a column with a default constraint defined with a value of system_user.

After doing a sql compare, the syncronization script changes the default constraint definition to system_user() which is incorrect.

There is no system_user() function in sql server. It should just be system_user.

Example :-
Original script is -
CREATE TABLE [dbo].[Test]
[Test_ID] [int] IDENTITY(1,1) NOT NULL,
[User_Created] [varchar](100) NOT NULL DEFAULT (system_user)

After sql compare with a database which does not have this table, the syncronization script output is -
CREATE TABLE [dbo].[Test]
[Test_ID] [int] IDENTITY(1,1) NOT NULL,
[User_Created] [varchar](100) NOT NULL DEFAULT (system_user())

This syncronization script when executed on target server will throw error because there is no such function as system_user().

Please investigate.



  • Thank you for your post.

    My thinking at the moment is that the SQL Compare engine is having problems interpreting the default value as a string " DEFAULT (system_user) ".

    The usual form for this in t-sql is
    Name varchar(255) DEFAULT 'string'

    While SQL Server is able to correctly interpret the form of
    Name varchar(255) DEFAULT (Sandnes)
    as a string. The SQL Compare engine has not been designed to do so. Can you therefore try changing your original script (or write a test object) using the single quotes instead of the brackets and then test it with our tool.

    Please can you let me know how you get on.
  • Thank you for taking a look. But I am not sure if you understood the issue correctly.

    I am not defining the default to be of string type value 'system_user'
    I am defining the default to be of value returned by the sql server function system_user
    and therefore the below definition -

    [User_Created] [varchar](100) NOT NULL DEFAULT system_user
Sign In or Register to comment.