Skip to content

Commit

Permalink
Merge pull request #24 from rlaveycal/issue_23
Browse files Browse the repository at this point in the history
Only create string_split if DB level doesn't have it
  • Loading branch information
magne authored Nov 15, 2021
2 parents 6bff314 + b9be10a commit d520670
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sql/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (c *Connector) CreateUser(ctx context.Context, database string, user *model
'DEFAULT_LANGUAGE = ' + Coalesce(QuoteName(@language), 'NONE')
END
END
IF objectproperty(object_id('String_Split'), 'isProcedure') IS NULL
IF exists (select compatibility_level FROM sys.databases where name = db_name() and compatibility_level < 130)
BEGIN
DECLARE @sql NVARCHAR(MAX);
SET @sql = N'Create FUNCTION [dbo].[String_Split]
Expand Down Expand Up @@ -191,7 +191,7 @@ func (c *Connector) UpdateUser(ctx context.Context, database string, user *model
BEGIN
SET @stmt = @stmt + ', DEFAULT_LANGUAGE = ' + Coalesce(QuoteName(@language), 'NONE')
END
IF objectproperty(object_id('String_Split'), 'isProcedure') IS NULL
IF exists (select compatibility_level FROM sys.databases where name = db_name() and compatibility_level < 130)
BEGIN
DECLARE @sql NVARCHAR(MAX);
SET @sql = N'Create FUNCTION [dbo].[String_Split]
Expand Down

0 comments on commit d520670

Please sign in to comment.