Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Sunday, March 25, 2012

Changing between Identity type and Int type

What is the TSQL command to chanage a column of int type to identity type
and vice versa?
Thanks in advance!
KMYou can't add the IDENTITY property to an existing table - you need to
create a new table with the IDENTITY column. If you have existing data, you
can create it with a different name, INSERT the existing data, drop the
existing table, then rename the new table. Enterprise Manager will do this
for you if you add the property in the table designer.
HTH. Ryan
"krygim" <krygim@.hotmail.com> wrote in message
news:OccfMRAIGHA.2012@.TK2MSFTNGP14.phx.gbl...
> What is the TSQL command to chanage a column of int type to identity type
> and vice versa?
> Thanks in advance!
> KM
>|||To add on, if your table is having millions of data do go for Enterprise
Manager, you can mess up your life doing so. It will remain in a hanged
situation. So better do it manual ways like creating a new table and renamin
g
droping the original one.
Thanks,
Sree
"Ryan" wrote:

> You can't add the IDENTITY property to an existing table - you need to
> create a new table with the IDENTITY column. If you have existing data, yo
u
> can create it with a different name, INSERT the existing data, drop the
> existing table, then rename the new table. Enterprise Manager will do this
> for you if you add the property in the table designer.
> --
> HTH. Ryan
> "krygim" <krygim@.hotmail.com> wrote in message
> news:OccfMRAIGHA.2012@.TK2MSFTNGP14.phx.gbl...
>
>|||But when I insert the existing data into the new table with the identity
column, how can I make sure that the keys are not changed?
(I am thinking of existing data having integer keys and a lot of unused
numbers due to deletions.)
Ryan wrote:

> You can't add the IDENTITY property to an existing table - you need to
> create a new table with the IDENTITY column. If you have existing data, yo
u
> can create it with a different name, INSERT the existing data, drop the
> existing table, then rename the new table. Enterprise Manager will do this
> for you if you add the property in the table designer.
>|||> You can't add the IDENTITY property to an existing table -
No ,you CAN
create table #t
(
col1 char(1)
)
insert into #t values ('a')
insert into #t values ('b')
insert into #t values ('c')
alter table #t add col2 int identity(1,1)
select * from #t
Actually you cannot EDIT/ALTER an IDENTITY property
"Ryan" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:es%23Y6YAIGHA.2628@.TK2MSFTNGP15.phx.gbl...
> You can't add the IDENTITY property to an existing table - you need to
> create a new table with the IDENTITY column. If you have existing data,
> you
> can create it with a different name, INSERT the existing data, drop the
> existing table, then rename the new table. Enterprise Manager will do this
> for you if you add the property in the table designer.
> --
> HTH. Ryan
> "krygim" <krygim@.hotmail.com> wrote in message
> news:OccfMRAIGHA.2012@.TK2MSFTNGP14.phx.gbl...
>|||My understanding of the question was to add the identity property to an
existing INT column, admitidly my opening sentance should have read :-
You can't add the IDENTITY property to an existing column
rather than
You can't add the IDENTITY property to an existing table -
Apologies for any mis-understanding. Either way KM now has an answer to his
question.
HTH. Ryan
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eiljmwAIGHA.1388@.TK2MSFTNGP11.phx.gbl...
> No ,you CAN
> create table #t
> (
> col1 char(1)
> )
> insert into #t values ('a')
> insert into #t values ('b')
> insert into #t values ('c')
> alter table #t add col2 int identity(1,1)
> select * from #t
>
> Actually you cannot EDIT/ALTER an IDENTITY property
>
> "Ryan" <Ryan_Waight@.nospam.hotmail.com> wrote in message
> news:es%23Y6YAIGHA.2628@.TK2MSFTNGP15.phx.gbl...
>|||Ryan,
In the Enterprise Manager, I can create an int column with non-contiguous
(and even duplicated) values in different records, e.g., 1, 31, 1, 7 in 4
records. (Please note that the values are not in ascending order and two of
them are duplicated.) Then later, I can change the column to an identity
column without any value change. Thus I am sure that rather than dropping
and recreating the column, the Enterprise Manager is doing it in another
way. Please correct me know if I am wrong.
KM
"Ryan" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:es%23Y6YAIGHA.2628@.TK2MSFTNGP15.phx.gbl...
> You can't add the IDENTITY property to an existing table - you need to
> create a new table with the IDENTITY column. If you have existing data,
you
> can create it with a different name, INSERT the existing data, drop the
> existing table, then rename the new table. Enterprise Manager will do this
> for you if you add the property in the table designer.
> --
> HTH. Ryan
> "krygim" <krygim@.hotmail.com> wrote in message
> news:OccfMRAIGHA.2012@.TK2MSFTNGP14.phx.gbl...
type
>|||Hi Ferdinand,
To your question:
You should Set identity_insert on on the new table with the identity
before you insert the data.
The Set will last for the session or until you set identity_insert off.
Example:
Create table #source (cola int, colb int)
insert into #source values (1,2)
insert into #source values (3,4)
Create table #dest (cola int identity, colb int)
set identity_insert #dest on
Insert into #dest (cola,colb)
Select cola, colb
From #source
Select *
from #dest
-- drop table #dest
-- drop table #source
"Ferdinand Zaubzer" wrote:

> But when I insert the existing data into the new table with the identity
> column, how can I make sure that the keys are not changed?
> (I am thinking of existing data having integer keys and a lot of unused
> numbers due to deletions.)
>
> Ryan wrote:
>
>|||Run the SQL Profiler as the EM makes the change. You'll be amazed.
ML
http://milambda.blogspot.com/|||> Thus I am sure that rather than dropping
> and recreating the column, the Enterprise Manager is doing it in another
> way. Please correct me know if I am wrong.
>
Enterprise Manager create a new table, loads data from the old table and
them drops the old table to implement this change. You can verify this with
a Profiler trace or by clicking the 'save change script' button. The end
result is as if the identity property was simply added to the column but the
actual technique used is more involved.
Hope this helps.
Dan Guzman
SQL Server MVP
"Krygim" <krygim@.hotmail.com> wrote in message
news:OrPh5wBIGHA.2912@.tk2msftngp13.phx.gbl...
> Ryan,
> In the Enterprise Manager, I can create an int column with non-contiguous
> (and even duplicated) values in different records, e.g., 1, 31, 1, 7 in 4
> records. (Please note that the values are not in ascending order and two
> of
> them are duplicated.) Then later, I can change the column to an identity
> column without any value change. Thus I am sure that rather than dropping
> and recreating the column, the Enterprise Manager is doing it in another
> way. Please correct me know if I am wrong.
> KM
>
> "Ryan" <Ryan_Waight@.nospam.hotmail.com> wrote in message
> news:es%23Y6YAIGHA.2628@.TK2MSFTNGP15.phx.gbl...
> you
> type
>

Sunday, March 11, 2012

Change UNC of DB Backup?

What is the easiest way to change the location where I backup my databases?
Can I just modify the command field of the sysjobsteps table or is there a
stored proc I can use instead? They're setup using the DB Maint plan at the
moment and I have about 20 to change on 3 servers, so I'd prefer to not do
it manually. This will be on 2 2k servers and one sql7 server.
TIA
Matt
>
> Take a look into the system stored procedure sp_update_jobstep in MSDB
> database.
>
Hari-
I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
how can I take what is already there and change the command field to reflect
the new UNC. The command line for that is huge and there are 2 places that
the UNC needs to be changed in it. Can I run a select statement and exec
sp_update_jobstep on each row returned from the select using the Replace()
function?
|||One thing to note is that backing up to a UNC share has permission
implications - you may need to change the credentials of the SQL Server
and Agent services to a domain one.
Regards
Stuart
Matt Williamson wrote:
> Hari-
> I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
> how can I take what is already there and change the command field to reflect
> the new UNC. The command line for that is huge and there are 2 places that
> the UNC needs to be changed in it. Can I run a select statement and exec
> sp_update_jobstep on each row returned from the select using the Replace()
> function?
|||Hello,
Execute the sp_update_jobstep using the parameters @.Jobname,@.JobStep_id and
@.command. If you give an UNC path ensure that the SQL Server Startup account
have
rights to read and write that partcular share and directory.
Thanks
Hari
"Matt Williamson" <ih8spam@.spamsux.org> wrote in message
news:OCXSGq2LHHA.2028@.TK2MSFTNGP03.phx.gbl...
> Hari-
> I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
> how can I take what is already there and change the command field to
> reflect the new UNC. The command line for that is huge and there are 2
> places that the UNC needs to be changed in it. Can I run a select
> statement and exec sp_update_jobstep on each row returned from the select
> using the Replace() function?
>
>
|||Thanks for the input. That's a non-issue though. It's already a UNC path.
I'm just changing it to a different one. The service that runs the job is
already a domain level account with appropriate permissions.
"NonNB" <nonnb@.webmail.co.za> wrote in message
news:1167905284.272432.183690@.i80g2000cwc.googlegr oups.com...
> One thing to note is that backing up to a UNC share has permission
> implications - you may need to change the credentials of the SQL Server
> and Agent services to a domain one.
> Regards
> Stuart
> Matt Williamson wrote:
>
|||> Execute the sp_update_jobstep using the parameters @.Jobname,@.JobStep_id
> and @.command. If you give an UNC path ensure that the SQL Server Startup
> account have
> rights to read and write that partcular share and directory.
Would there be any disadvantage to running something like this?
Update sysjobsteps
set command = replace(command, '\\OLDSERVER', '\\NEWSERVER')
where command like 'EXECUTE%'
In a test table that I created using a select from sysjobsteps, it worked
exactly how I wanted. I haven't tried it on the actual sysjobsteps table in
the msdb database yet though.

Thursday, March 8, 2012

Change UNC of DB Backup?

What is the easiest way to change the location where I backup my databases?
Can I just modify the command field of the sysjobsteps table or is there a
stored proc I can use instead? They're setup using the DB Maint plan at the
moment and I have about 20 to change on 3 servers, so I'd prefer to not do
it manually. This will be on 2 2k servers and one sql7 server.
TIA
Matt>
> Take a look into the system stored procedure sp_update_jobstep in MSDB
> database.
>
Hari-
I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
how can I take what is already there and change the command field to reflect
the new UNC. The command line for that is huge and there are 2 places that
the UNC needs to be changed in it. Can I run a select statement and exec
sp_update_jobstep on each row returned from the select using the Replace()
function?|||One thing to note is that backing up to a UNC share has permission
implications - you may need to change the credentials of the SQL Server
and Agent services to a domain one.
Regards
Stuart
Matt Williamson wrote:
> >
> > Take a look into the system stored procedure sp_update_jobstep in MSDB
> > database.
> >
> Hari-
> I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
> how can I take what is already there and change the command field to reflect
> the new UNC. The command line for that is huge and there are 2 places that
> the UNC needs to be changed in it. Can I run a select statement and exec
> sp_update_jobstep on each row returned from the select using the Replace()
> function?|||Hello,
Execute the sp_update_jobstep using the parameters @.Jobname,@.JobStep_id and
@.command. If you give an UNC path ensure that the SQL Server Startup account
have
rights to read and write that partcular share and directory.
Thanks
Hari
"Matt Williamson" <ih8spam@.spamsux.org> wrote in message
news:OCXSGq2LHHA.2028@.TK2MSFTNGP03.phx.gbl...
> >
>> Take a look into the system stored procedure sp_update_jobstep in MSDB
>> database.
> Hari-
> I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
> how can I take what is already there and change the command field to
> reflect the new UNC. The command line for that is huge and there are 2
> places that the UNC needs to be changed in it. Can I run a select
> statement and exec sp_update_jobstep on each row returned from the select
> using the Replace() function?
>
>|||Thanks for the input. That's a non-issue though. It's already a UNC path.
I'm just changing it to a different one. The service that runs the job is
already a domain level account with appropriate permissions.
"NonNB" <nonnb@.webmail.co.za> wrote in message
news:1167905284.272432.183690@.i80g2000cwc.googlegroups.com...
> One thing to note is that backing up to a UNC share has permission
> implications - you may need to change the credentials of the SQL Server
> and Agent services to a domain one.
> Regards
> Stuart
> Matt Williamson wrote:
>> >
>> > Take a look into the system stored procedure sp_update_jobstep in MSDB
>> > database.
>> >
>> Hari-
>> I've been reading about the sp_update_jobstep proc in BOL but I'm not
>> sure
>> how can I take what is already there and change the command field to
>> reflect
>> the new UNC. The command line for that is huge and there are 2 places
>> that
>> the UNC needs to be changed in it. Can I run a select statement and exec
>> sp_update_jobstep on each row returned from the select using the
>> Replace()
>> function?
>|||> Execute the sp_update_jobstep using the parameters @.Jobname,@.JobStep_id
> and @.command. If you give an UNC path ensure that the SQL Server Startup
> account have
> rights to read and write that partcular share and directory.
Would there be any disadvantage to running something like this?
Update sysjobsteps
set command = replace(command, '\\OLDSERVER', '\\NEWSERVER')
where command like 'EXECUTE%'
In a test table that I created using a select from sysjobsteps, it worked
exactly how I wanted. I haven't tried it on the actual sysjobsteps table in
the msdb database yet though.

Change UNC of DB Backup?

What is the easiest way to change the location where I backup my databases?
Can I just modify the command field of the sysjobsteps table or is there a
stored proc I can use instead? They're setup using the DB Maint plan at the
moment and I have about 20 to change on 3 servers, so I'd prefer to not do
it manually. This will be on 2 2k servers and one sql7 server.
TIA
MattHello,
Take a look into the system stored procedure sp_update_jobstep in MSDB
database.
Thanks
Hari
"Matt Williamson" wrote:

> What is the easiest way to change the location where I backup my databases
?
> Can I just modify the command field of the sysjobsteps table or is there a
> stored proc I can use instead? They're setup using the DB Maint plan at th
e
> moment and I have about 20 to change on 3 servers, so I'd prefer to not do
> it manually. This will be on 2 2k servers and one sql7 server.
> TIA
> Matt
>
>|||>
> Take a look into the system stored procedure sp_update_jobstep in MSDB
> database.
>
Hari-
I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
how can I take what is already there and change the command field to reflect
the new UNC. The command line for that is huge and there are 2 places that
the UNC needs to be changed in it. Can I run a select statement and exec
sp_update_jobstep on each row returned from the select using the Replace()
function?|||One thing to note is that backing up to a UNC share has permission
implications - you may need to change the credentials of the SQL Server
and Agent services to a domain one.
Regards
Stuart
Matt Williamson wrote:
> Hari-
> I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
> how can I take what is already there and change the command field to refle
ct
> the new UNC. The command line for that is huge and there are 2 places that
> the UNC needs to be changed in it. Can I run a select statement and exec
> sp_update_jobstep on each row returned from the select using the Replace()
> function?|||Hello,
Execute the sp_update_jobstep using the parameters @.Jobname,@.JobStep_id and
@.command. If you give an UNC path ensure that the SQL Server Startup account
have
rights to read and write that partcular share and directory.
Thanks
Hari
"Matt Williamson" <ih8spam@.spamsux.org> wrote in message
news:OCXSGq2LHHA.2028@.TK2MSFTNGP03.phx.gbl...
> Hari-
> I've been reading about the sp_update_jobstep proc in BOL but I'm not sure
> how can I take what is already there and change the command field to
> reflect the new UNC. The command line for that is huge and there are 2
> places that the UNC needs to be changed in it. Can I run a select
> statement and exec sp_update_jobstep on each row returned from the select
> using the Replace() function?
>
>|||Thanks for the input. That's a non-issue though. It's already a UNC path.
I'm just changing it to a different one. The service that runs the job is
already a domain level account with appropriate permissions.
"NonNB" <nonnb@.webmail.co.za> wrote in message
news:1167905284.272432.183690@.i80g2000cwc.googlegroups.com...
> One thing to note is that backing up to a UNC share has permission
> implications - you may need to change the credentials of the SQL Server
> and Agent services to a domain one.
> Regards
> Stuart
> Matt Williamson wrote:
>|||> Execute the sp_update_jobstep using the parameters @.Jobname,@.JobStep_id
> and @.command. If you give an UNC path ensure that the SQL Server Startup
> account have
> rights to read and write that partcular share and directory.
Would there be any disadvantage to running something like this?
Update sysjobsteps
set command = replace(command, '\\OLDSERVER', '\\NEWSERVER')
where command like 'EXECUTE%'
In a test table that I created using a select from sysjobsteps, it worked
exactly how I wanted. I haven't tried it on the actual sysjobsteps table in
the msdb database yet though.

Wednesday, March 7, 2012

Change the DATETIME format to DD/MM/YYYY by using CONVERT command.

I have a database table named EMP and I have a column named
DOB(datetime) .I want to retrieve just the MM/DD/YYYY part by using
the CONVERT command.And also I need to change the MM/DD/YYYY to DD/MM/
YYYY format by using the CONVERT command by SQL query.What is the
solution ?
Thank you.
Amritendu Paul
hi Paul,
amripaul@.gmail.com wrote:
> I have a database table named EMP and I have a column named
> DOB(datetime) .I want to retrieve just the MM/DD/YYYY part by using
> the CONVERT command.And also I need to change the MM/DD/YYYY to DD/MM/
> YYYY format by using the CONVERT command by SQL query.What is the
> solution ?
> Thank you.
> Amritendu Paul
please have a look at CONVERT function in BOL:
SET NOCOUNT ON;
SELECT CONVERT(varchar(10), GETDATE(), 103) AS [my formatted date];
--<--
my formatted date
11/06/2007
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
-- remove DMO to reply

Friday, February 24, 2012

Change SQL Command at runtime?

I have tried some of the fixes for the other posts but it still doesn't work.
My query looks like this:
SELECT *
FROM table1 AS t1, table1 AS t2
WHERE t1.id =t2.id + @.myParam
I want @.myParam to have a value of =" AND t1.custId=t2.custId "
How can I make this work?Use an expression as your source. Note that once you do this in the dataset
tab that you can no longer execute the query or get the field list returned
so make sure you have the appropriate field list before you change it to an
expression.
="SELECT * FROM table1 AS t1, table1 AS t2 WHERE t1.id =t2.id " &
Parameters!myParam.Value
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"KCBTDev" <KCBTDev@.discussions.microsoft.com> wrote in message
news:95A60AE1-12C4-4CF3-9A82-B037D9E57BFB@.microsoft.com...
>I have tried some of the fixes for the other posts but it still doesn't
>work.
> My query looks like this:
> SELECT *
> FROM table1 AS t1, table1 AS t2
> WHERE t1.id =t2.id + @.myParam
> I want @.myParam to have a value of =" AND t1.custId=t2.custId "
> How can I make this work?|||How do I set the source? This query is a very large query with many other
parameters being used to narrow down the search and return data. I use a
text command type in the data tab.
"Bruce L-C [MVP]" wrote:
> Use an expression as your source. Note that once you do this in the dataset
> tab that you can no longer execute the query or get the field list returned
> so make sure you have the appropriate field list before you change it to an
> expression.
> ="SELECT * FROM table1 AS t1, table1 AS t2 WHERE t1.id =t2.id " &
> Parameters!myParam.Value
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "KCBTDev" <KCBTDev@.discussions.microsoft.com> wrote in message
> news:95A60AE1-12C4-4CF3-9A82-B037D9E57BFB@.microsoft.com...
> >I have tried some of the fixes for the other posts but it still doesn't
> >work.
> >
> > My query looks like this:
> > SELECT *
> > FROM table1 AS t1, table1 AS t2
> > WHERE t1.id =t2.id + @.myParam
> >
> > I want @.myParam to have a value of =" AND t1.custId=t2.custId "
> >
> > How can I make this work?
>
>|||Ok I have it figured out. I left the existing parameters setup as is and
just put a =" at the beginning of the query, a " at the end, and took out all
Carriage Returns and it works. Thanks for all of your help!
"KCBTDev" wrote:
> How do I set the source? This query is a very large query with many other
> parameters being used to narrow down the search and return data. I use a
> text command type in the data tab.
> "Bruce L-C [MVP]" wrote:
> > Use an expression as your source. Note that once you do this in the dataset
> > tab that you can no longer execute the query or get the field list returned
> > so make sure you have the appropriate field list before you change it to an
> > expression.
> >
> > ="SELECT * FROM table1 AS t1, table1 AS t2 WHERE t1.id =t2.id " &
> > Parameters!myParam.Value
> >
> >
> > --
> > Bruce Loehle-Conger
> > MVP SQL Server Reporting Services
> >
> > "KCBTDev" <KCBTDev@.discussions.microsoft.com> wrote in message
> > news:95A60AE1-12C4-4CF3-9A82-B037D9E57BFB@.microsoft.com...
> > >I have tried some of the fixes for the other posts but it still doesn't
> > >work.
> > >
> > > My query looks like this:
> > > SELECT *
> > > FROM table1 AS t1, table1 AS t2
> > > WHERE t1.id =t2.id + @.myParam
> > >
> > > I want @.myParam to have a value of =" AND t1.custId=t2.custId "
> > >
> > > How can I make this work?
> >
> >
> >

Change SQL command at runtime using a stored procedure?

My query looks like this:
SELECT *
FROM table1 AS t1, table1 AS t2
WHERE t1.id =t2.id + @.myParam
I want @.myParam to have a value of =" AND t1.custId=t2.custId "
How can I make this work?
I did have my report working correctly with my source as an expression. But
with added complexities to the query, it will be easier to maintain in a
stored procedure.Sounds like you need to research dynamic sql
"KCBTDev" wrote:
> My query looks like this:
> SELECT *
> FROM table1 AS t1, table1 AS t2
> WHERE t1.id =t2.id + @.myParam
> I want @.myParam to have a value of =" AND t1.custId=t2.custId "
> How can I make this work?
> I did have my report working correctly with my source as an expression. But
> with added complexities to the query, it will be easier to maintain in a
> stored procedure.

change small letter to capitals letters

I need to change over 300 records in a table field that have small letters to
capitals letters. Which sql command statement would change this?
Thanks in advance
Dave
Example:
update table1
set c1 = upper(c1)
AMB
"DCR" wrote:

> I need to change over 300 records in a table field that have small letters to
> capitals letters. Which sql command statement would change this?
> Thanks in advance
> Dave

change small letter to capitals letters

I need to change over 300 records in a table field that have small letters t
o
capitals letters. Which sql command statement would change this?
Thanks in advance
DaveExample:
update table1
set c1 = upper(c1)
AMB
"DCR" wrote:

> I need to change over 300 records in a table field that have small letters
to
> capitals letters. Which sql command statement would change this?
> Thanks in advance
> Dave

change small letter to capitals letters

I need to change over 300 records in a table field that have small letters to
capitals letters. Which sql command statement would change this?
Thanks in advance
DaveExample:
update table1
set c1 = upper(c1)
AMB
"DCR" wrote:
> I need to change over 300 records in a table field that have small letters to
> capitals letters. Which sql command statement would change this?
> Thanks in advance
> Dave

Sunday, February 19, 2012

Change request: Parameter mapping

In some places in the SSIS enviroment, you can use parameters in queries, for examples in the query part of the OLE DB Command component.

You do this by specifying placeholders using question marks. The question marks result in parameters on the Column Mappings tab of the Advanced Editor named Param_0, Param_1, etc. When adding question marks to the query later on, new parameters are created named Param_<x>, where ‘x’ is the next higher index number, no matter where the question mark appears in the query. If, for example, your initial query contains two parameters and later on you add a third one that appears as the first parameter in the query, it results in a new Param_3 on the Column Mappings tab.

This is all a bit confusing and not very wanted from a maintenance point of view. I know this might be a limitation caused by using OLE DB connections; we tried to do something with ADO.NET connections, but until now, not very succesful. Therefore we think this is something to put on a wish list for a next SSIS version. It would be great to have the opportunity to give parameters a meaningful name, in stead of the question marks in the queries and the generated Param_<x> names in other places.
Hans Geurtsen
MoreInfo BV

I couldn't agree more. I recently had to do the same thing for a pipeline with >50 columns in it. Debugging it when it didn't work was near impossible.

You should raise this request at http://lab.msdn.microsoft.com/productfeedback/default.aspx (and let us know because I will vote for it) and also on the "SSIS Requests" thread at the top of this forum.

-Jamie

Tuesday, February 14, 2012

Change ownership

Hello I'm trying to change the ownership using this command :

sp_changeobjectowner'govern.NA_WEB_SUBS_HITS','dbo'

and then I received this following error message :

Msg 15001, Level 16, State 1, Procedure sp_changeobjectowner, Line 75
Object 'govern.NA_WEB_SUBS_HITS' does not exist or is not a valid object for this operation.

Can anyone help please?

Thanks,

Stanley

You need to speicify the current owner on this object to change:

sp_changeobjectowner 'Dbobject', 'dbo'

|||

NOTE: sp_changeobjectowner has been deprecated in SQL Server 2005. I strongly recommend using the new DDL designed for changing ownership: ALTER AUTHORIZATION.

For more information please refer to BOL:

· ALTER AUTHORIZATION (Transact-SQL) http://msdn2.microsoft.com/en-us/library/ms187359.aspx

· sp_changeobjectowner (Transact-SQL) http://msdn2.microsoft.com/en-us/library/ms177519.aspx

Thanks a lot,

-Raul Garcia

SDE/T

SQL Server Engine

|||

What if the "current owner" does not exist? After a total system crash we made a db restore. All the objects belong to a sql user that does not exist anymore (different sid). What can we do now? http://support.microsoft.com/kb/275312/en-us has a good script generator but we got stuck "oldOwner.dbObject" does not exist!!!

Change ownership

Hello I'm trying to change the ownership using this command :

sp_changeobjectowner 'govern.NA_WEB_SUBS_HITS' , 'dbo'

and then I received this following error message :

Msg 15001, Level 16, State 1, Procedure sp_changeobjectowner, Line 75
Object 'govern.NA_WEB_SUBS_HITS' does not exist or is not a valid object for this operation.

Can anyone help please?

Thanks,

Stanley

You need to speicify the current owner on this object to change:

sp_changeobjectowner 'Dbobject', 'dbo'

|||

NOTE: sp_changeobjectowner has been deprecated in SQL Server 2005. I strongly recommend using the new DDL designed for changing ownership: ALTER AUTHORIZATION.

For more information please refer to BOL:

· ALTER AUTHORIZATION (Transact-SQL) http://msdn2.microsoft.com/en-us/library/ms187359.aspx

· sp_changeobjectowner (Transact-SQL) http://msdn2.microsoft.com/en-us/library/ms177519.aspx

Thanks a lot,

-Raul Garcia

SDE/T

SQL Server Engine

|||

What if the "current owner" does not exist? After a total system crash we made a db restore. All the objects belong to a sql user that does not exist anymore (different sid). What can we do now? http://support.microsoft.com/kb/275312/en-us has a good script generator but we got stuck "oldOwner.dbObject" does not exist!!!