Untitled

mail@pastecode.io avatar
unknown
sqlserver
a month ago
866 B
4
Indexable
Never

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'last_reset_time'
      AND Object_ID = Object_ID(N'Character'))
BEGIN
   ALTER TABLE Character ADD last_reset_time INT NULL
END
GO

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'last_greset_time'
      AND Object_ID = Object_ID(N'Character'))
BEGIN
   ALTER TABLE Character ADD last_greset_time INT NULL
END
GO

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'dmn_pk_count'
      AND Object_ID = Object_ID(N'Character'))
BEGIN
   ALTER TABLE Character ADD dmn_pk_count INT NOT NULL DEFAULT 0
END
GO

IF NOT EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'dmn_last_server_pk_count'
      AND Object_ID = Object_ID(N'Character'))
BEGIN
   ALTER TABLE Character ADD dmn_last_server_pk_count INT NOT NULL DEFAULT 0
END
GO
Leave a Comment