Attempting to run the script set-owner-to-dbo.sql leads to an "Invalid Column" error

0 Likes

Problem:

Attempting to run the script set-owner-to-dbo.sql leads to an "Invalid Column" error

Resolution:

  • Product Name: StarTeam
  • Product Version: 2005
  • Product Component: Test Director Synchronizer 8.0
  • Platform/OS Version: All
  • Database: SQL Server

Description:

For StarTeam TestDirector Synchronizer, one of the installation instructions in the Release Notes is to run the script "set-owner-to-dbo.sql". Attempting to run this script in the SQL Server Query Analyzer leads to an "invalid column" error.


Answer/Solution:

Change Request # 35788 has been filed as defect.

Workaround:

As SQL Server does not support double quotation marks, replace all double quotation marks in the script with single quotation marks and all single quotation marks with two single quotation marks (this tells SQL Server it is an embedded character and not a string delimiter).

Original SQL Script:

select @sqlstatement = " sp_changeobjectowner "" @name1 "." ltrim(rtrim(@name2)) " " , dbo"
EXEC(@sqlstatement)
select @sqlstatement = " grant all on " ltrim(rtrim(@name2)) " to public "
EXEC(@sqlstatement)

Script after the changes:

select @sqlstatement = " sp_changeobjectowner """ @name1 "." ltrim(rtrim(@name2)) " "" , dbo"
EXEC(@sqlstatement)
select @sqlstatement = " grant all on " ltrim(rtrim(@name2)) " to public "
EXEC(@sqlstatement)

After this change, the script should run fine.


Author:Rajini Billahalli

Old KB# 28179
Comment List
Related
Recommended