This is a common error when dropping a user from a database when it owns some schema. Usually you can use SSMS UI to uncheck the user from the owned schema.
After locating the owned schema by the user, the correct sql statement to change the owner of a schema is:
alter authorization on schema::schema_name to user_name
Friday, February 26, 2010
Thursday, February 18, 2010
How to reset a remote desktop session when you can't remote desktop to the target server
A refusing remote server can be annoying when you have ever tried to connect to it because of some urgent issue.
Solution is in this link.
Solution is in this link.
Labels:
reste remote desktop session
Understanding the Identity column
Here is the original article.
A common problem encountered by most DBA's is to insert values into a table with an identity column and "set identity_insert on table_name on" should be used.
Three quick ways to show the last identity value that was just inserted:
select SCOPE_IDENTITY()
select @@IDENTITY
select ident_current('table_name')
The differences between them are stated in the above linked article.
Another important command for reseeding the identity column is:
A common problem encountered by most DBA's is to insert values into a table with an identity column and "set identity_insert on table_name on" should be used.
Three quick ways to show the last identity value that was just inserted:
select SCOPE_IDENTITY()
select @@IDENTITY
select ident_current('table_name')
The differences between them are stated in the above linked article.
Another important command for reseeding the identity column is:
DBCC CHECKIDENT('table_name', RESEED, 1)
Friday, January 29, 2010
Check available disk space in all the database files
Here is the script:
use [db_name]
go
select name, size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') as int)/128.0 as AvailableSpaceInMB
from sys.database_files
go
Knowing this info is a good guide for file shrinking operations.
use [db_name]
go
select name, size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') as int)/128.0 as AvailableSpaceInMB
from sys.database_files
go
Knowing this info is a good guide for file shrinking operations.
Labels:
database files,
disk space
The link between bcp utility and the bulk insert statement
Just tried to find out the real difference between bcp utility and bulk insert statement and here is the article from Microsoft's official site.
Quoted too: "The BULK INSERT statement allows you to bulk copy data to an instance of SQL Server using the functionality of the bcp utility with a Transact-SQL statement, rather than from the command prompt."
Therefore, it seems the whole "bulk insert" statement is purely another way of "bcp in" command.
Quoted too: "The BULK INSERT statement allows you to bulk copy data to an instance of SQL Server using the functionality of the bcp utility with a Transact-SQL statement, rather than from the command prompt."
Therefore, it seems the whole "bulk insert" statement is purely another way of "bcp in" command.
Labels:
bcp,
bulk insert
Subscribe to:
Posts (Atom)