Monday, March 26, 2012
how to change Owner
test.i want to replace this owner with dbo.
i execute the sp_changeobjectowner 'tbluser' ,'dbo'
while i try to this i got the error
Server: Msg 15001, Level 16, State 1, Procedure
sp_changeobjectowner, Line 38
Object 'tblUser' does not exist or is not a valid object for this
operation.
i login as an 'sa' while trying to perform this operation.
Please let me know how do i change the owner.Try,
sp_changeobjectowner 'test.tbluser' ,'dbo'
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Mustafa" <Mustafa@.discussions.microsoft.com> wrote in message
news:616C728C-4CE0-4F9D-BC3A-947CE7A57388@.microsoft.com...
>i want to change the database owner to dbo.rightnow the owner is
> test.i want to replace this owner with dbo.
> i execute the sp_changeobjectowner 'tbluser' ,'dbo'
> while i try to this i got the error
> Server: Msg 15001, Level 16, State 1, Procedure
> sp_changeobjectowner, Line 38
> Object 'tblUser' does not exist or is not a valid object for this
> operation.
>
> i login as an 'sa' while trying to perform this operation.
> Please let me know how do i change the owner.
Wednesday, March 21, 2012
How to change collation on a server?
How to change collation on a server?. When I execute "rebuildm.exe" to
change collation on a server, computer always be Hung. Why is it happended?
How to solve it?Hi
Use ALTER DATABASE ... command. Actually the old objects will remain with
old COLLATION.
To change it take a looka ALTER TABLE....ALTER COLUMN ... commands
For more details please refer to the BOL.
"Bpk. Adi Wira Kusuma" <adi_wira_kusuma@.yahoo.com.sg> wrote in message
news:%23xfHor5VGHA.5076@.TK2MSFTNGP11.phx.gbl...
>I use SQL server 2000.
> How to change collation on a server?. When I execute "rebuildm.exe" to
> change collation on a server, computer always be Hung. Why is it
> happended?
> How to solve it?
>|||Copy the source files for the system database to the hard drive, and *remove
the read-only
attribute* of those files. Then point to that location when you run rebuildm
.exe.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Bpk. Adi Wira Kusuma" <adi_wira_kusuma@.yahoo.com.sg> wrote in message
news:%23xfHor5VGHA.5076@.TK2MSFTNGP11.phx.gbl...
>I use SQL server 2000.
> How to change collation on a server?. When I execute "rebuildm.exe" to
> change collation on a server, computer always be Hung. Why is it happended
?
> How to solve it?
>
Monday, March 12, 2012
How to capture return value from 'execute'
declare @.table varchar(100);
declare @.q varchar(100);
declare @.key bigint;
select @.table = 'key_table';
select @.q = 'select key from ' + @.table;
select @.key = exec(@.q); -> not working.
Check in books online; you'll find that the string execute version of the EXEC command does not provide the same ability to capture a return value as does the execution of a stored procedure. Sorry.|||In that case, can you suggest an alternative for the my requirement. I want to get the return value of a select statement constructed dynamically.
Thanks,
|||create a temp table and use this type
insert into #tempTable
exec ( @.yourExecString )
Also, understand that using the EXEC ( @.yourExecString ) syntax might leave you subject to SQL INJECTION attacks.
|||Use sp_executesql instead EXEC(...). You can use output paraeters with this sp.
declare @.table sysname;
declare @.q nvarchar(100);
declare @.key bigint;
select @.table = N'key_table';
select @.q = 'select @.key = key from dbo.[' + @.table + N']';
exec sp_executesql @.q, N'@.key bigint output', @.key output;
select @.key
go
Be careful with sql injection.
The Curse and Blessings of Dynamic SQL
http://www.sommarskog.se/dynamic_sql.html
AMB
How to capture out param?
them is an OUTPUT parameter. What does the
exec sp_name...
code, executed in QA SQL Server 2000, look like for this? Also, if the
OUTPUT parameter is declared last in the spoc, how can I call it by
name as the first parameter in my exec code?
Thanks,
BrettAssuming you have 5 parameters & the 5th one is an OUTPUT paramter, you can
call the procedure like:
EXEC usp @.p1, @.p2, @.p3, @.p4, @.p5 OUT
SELECT @.p5 ;
I know what you posted is just a sample, but in case hadn't noted, avoid
using sp_ prefix for stored procedures sicen they have certain unfavorable
implications.
Anith
How to cancel a processing request?
Hello ,
I've execute a wrong sql request from an ETL. This request is inserting lots of rows in a table. I want to cancel that process, is it possible to do this? If yes, how can I cancel that request?
Thanks,
Stop or 'kill' the client application that is doing the inserts.|||Find out the SPID that the request is running on, and then run KILL <thespidnumber>
You can probably find the SPID by running the query below, or by using sp_who2
SETNOCOUNTON;
DECLARE @.SpID smallint
DECLARE spID_Cursor CURSOR
FORWARD_ONLYREAD_ONLYFOR
SELECTTOP 25 spid
FROM master..sysprocesses
WHEREstatus='runnable'
AND spid > 50 -- Eliminate system SPIDs
AND spid <> 102 -- Replace with your SPID
ORDERBY CPU DESC
OPEN spID_Cursor
FETCHNEXTFROM spID_Cursor
INTO @.spID
WHILE@.@.FETCH_STATUS= 0
BEGIN
PRINT'Spid #: '+STR(@.spID)
EXEC('DBCC INPUTBUFFER ('+ @.spID +')')
FETCHNEXTFROM spID_Cursor
INTO @.spID
END
-- Close and deallocate the cursor
CLOSE spID_Cursor
DEALLOCATE spID_Cursor
|||thx more than I expectedHow to cancel a processing request?
Hello ,
I've execute a wrong sql request from an ETL. This request is inserting lots of rows in a table. I want to cancel that process, is it possible to do this? If yes, how can I cancel that request?
Thanks,
Stop or 'kill' the client application that is doing the inserts.|||Find out the SPID that the request is running on, and then run KILL <thespidnumber>
You can probably find the SPID by running the query below, or by using sp_who2
SETNOCOUNTON;
DECLARE @.SpID smallint
DECLARE spID_Cursor CURSOR
FORWARD_ONLYREAD_ONLYFOR
SELECTTOP 25 spid
FROM master..sysprocesses
WHEREstatus='runnable'
AND spid > 50 -- Eliminate system SPIDs
AND spid <> 102 -- Replace with your SPID
ORDERBY CPU DESC
OPEN spID_Cursor
FETCHNEXTFROM spID_Cursor
INTO @.spID
WHILE@.@.FETCH_STATUS= 0
BEGIN
PRINT'Spid #: '+STR(@.spID)
EXEC('DBCC INPUTBUFFER ('+ @.spID +')')
FETCHNEXTFROM spID_Cursor
INTO @.spID
END
-- Close and deallocate the cursor
CLOSE spID_Cursor
DEALLOCATE spID_Cursor
|||thx more than I expectedSunday, February 19, 2012
How to browse *.data file?
it would be generated a *.data file.
Can we browse *.data file?
Using Notepad? Office?
Thanks for any advice!
AngiI haven't looked on the server but I am pretty sure that this .data file is
a cache of data used for when you are developing. It is just the latest data
so while developing. You can delete it at any time and it will be recreated
the next time you are previewing the report. What is your reason/concern
about this file?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Angi" <enchiw@.msn.com> wrote in message
news:%232PR2uAEGHA.2300@.TK2MSFTNGP15.phx.gbl...
> We know that when we execute RS report,
> it would be generated a *.data file.
> Can we browse *.data file?
> Using Notepad? Office?
> Thanks for any advice!
> Angi
>|||Thanks Bruce!
The *.data file that I mentioned is on the client generate by Report
Designer.
Your description just as I think.
Cause the customer found her data on report designer and report manager
dosen't synchronize.
Report designer less 1, so she thought can browse the *.data to see what's
going on and why less 1.
I have the same problem on Reporting Service first version or SP1 version, I
forgot.
If I browse the parameter 2005/11 and generate 10 records then continue to
browse the 2005/12 and generate records.
If 2005/12 has 12 records, but cause first browse 2005/11 then 2005/12 just
present 10 records not 12 records!
Did you ever met this situation on earlier reporting services version?
After upgrade to SP1 or SP2 the problem be solved.
So, I think my customer has not upgrade to SP2 and called her to upgrade.
Angi
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> ¼¶¼g©ó¶l¥ó·s»D:ONPAcuBEGHA.532@.TK2MSFTNGP15.phx.gbl...
>I haven't looked on the server but I am pretty sure that this .data file is
>a cache of data used for when you are developing. It is just the latest
>data so while developing. You can delete it at any time and it will be
>recreated the next time you are previewing the report. What is your
>reason/concern about this file?
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Angi" <enchiw@.msn.com> wrote in message
> news:%232PR2uAEGHA.2300@.TK2MSFTNGP15.phx.gbl...
>> We know that when we execute RS report,
>> it would be generated a *.data file.
>> Can we browse *.data file?
>> Using Notepad? Office?
>> Thanks for any advice!
>> Angi
>|||The way it works is if no parameter changes then the designer continues to
use the data file. So if you have a report with no parameters, after the
first time previewing it, it will not hit the database again. You can always
manually delete the .data file which will cause the database to be hit. If
you have a parameter, then just change one of the parameters and a new .data
file will be generated. I am not aware of anything changing in this area
with the service packs.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Angi" <enchiw@.msn.com> wrote in message
news:%23n1f%239DEGHA.3892@.TK2MSFTNGP10.phx.gbl...
> Thanks Bruce!
> The *.data file that I mentioned is on the client generate by Report
> Designer.
> Your description just as I think.
> Cause the customer found her data on report designer and report manager
> dosen't synchronize.
> Report designer less 1, so she thought can browse the *.data to see what's
> going on and why less 1.
> I have the same problem on Reporting Service first version or SP1 version,
> I forgot.
> If I browse the parameter 2005/11 and generate 10 records then continue to
> browse the 2005/12 and generate records.
> If 2005/12 has 12 records, but cause first browse 2005/11 then 2005/12
> just present 10 records not 12 records!
> Did you ever met this situation on earlier reporting services version?
> After upgrade to SP1 or SP2 the problem be solved.
> So, I think my customer has not upgrade to SP2 and called her to upgrade.
> Angi
>
> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com>
> ¼¶¼g©ó¶l¥ó·s»D:ONPAcuBEGHA.532@.TK2MSFTNGP15.phx.gbl...
>>I haven't looked on the server but I am pretty sure that this .data file
>>is a cache of data used for when you are developing. It is just the latest
>>data so while developing. You can delete it at any time and it will be
>>recreated the next time you are previewing the report. What is your
>>reason/concern about this file?
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Angi" <enchiw@.msn.com> wrote in message
>> news:%232PR2uAEGHA.2300@.TK2MSFTNGP15.phx.gbl...
>> We know that when we execute RS report,
>> it would be generated a *.data file.
>> Can we browse *.data file?
>> Using Notepad? Office?
>> Thanks for any advice!
>> Angi
>>
>