Click here to Skip to main content
16,016,557 members
Home / Discussions / Database
   

Database

 
QuestionRe: hi Pin
Tauseef A14-Dec-06 19:35
Tauseef A14-Dec-06 19:35 
AnswerRe: hi Pin
Frank Kerrigan14-Dec-06 23:55
Frank Kerrigan14-Dec-06 23:55 
GeneralRe: hi Pin
Tauseef A15-Dec-06 6:31
Tauseef A15-Dec-06 6:31 
GeneralRe: hi Pin
Private_Void15-Dec-06 7:19
Private_Void15-Dec-06 7:19 
AnswerRe: hi Pin
S Douglas17-Dec-06 23:20
professionalS Douglas17-Dec-06 23:20 
QuestionExtended SP (CLRSP) in .net Pin
om474113-Dec-06 23:39
om474113-Dec-06 23:39 
QuestionRestoring a database problem - database in use Pin
steve_rm13-Dec-06 15:50
steve_rm13-Dec-06 15:50 
AnswerRe: Restoring a database problem - database in use Pin
Andy Brummer13-Dec-06 17:39
sitebuilderAndy Brummer13-Dec-06 17:39 
I use a sql script which closes all connections to the database. Note this is in development so I don't really care about the impact to the connected applications.

print getdate()
GO

use master

declare @dbName nvarchar(1024)
SELECT @dbName = 'dbname'

declare @rowCount int
declare @spid int

SELECT @rowCount = 1

while (@rowCount > 0)
BEGIN
	create table #temp
	(
		spid int,
		ecid int,
		status varchar(256),
		loginname varchar(256),
		hostname varchar(256),
		blk int,
		dbname varchar(256),
		cmd varchar(256),
		request_id int,
		id int identity
	)

	insert into #temp
	exec sp_who

	SELECT TOP 1 * FROM #temp WHERE dbname = @dbName 

	SELECT top 1 @spid = spid
	FROM #temp
	WHERE dbname = @dbName 

	SELECT @rowCount = @@rowcount

	if (@rowCount > 0)
		exec('kill ' + @spid )

	drop table #temp
END


RESTORE DATABASE [MedinaGold] 
FROM  DISK = N'backupFileLocation' 
WITH  FILE = 1,  
	MOVE N'data_name' TO N'c:\data\2005\cs\_Data.mdf',  
	MOVE N'log_name' TO N'c:\data\2005\cs\_Log.ldf',  
	NOUNLOAD,  REPLACE,  STATS = 10
GO


Just replace the database and file names with your values.


Using the GridView is like trying to explain to someone else how to move a third person's hands in order to tie your shoelaces for you.
-Chris Maunder


QuestionRe: Restoring a database problem - database in use Pin
steve_rm13-Dec-06 18:45
steve_rm13-Dec-06 18:45 
AnswerRe: Restoring a database problem - database in use Pin
Andy Brummer13-Dec-06 18:48
sitebuilderAndy Brummer13-Dec-06 18:48 
GeneralRe: Restoring a database problem - database in use Pin
steve_rm14-Dec-06 0:55
steve_rm14-Dec-06 0:55 
QuestionArray fo MySqlDataAdapter Pin
Tomy140213-Dec-06 15:50
Tomy140213-Dec-06 15:50 
AnswerRe: Array fo MySqlDataAdapter Pin
Andy Brummer13-Dec-06 17:40
sitebuilderAndy Brummer13-Dec-06 17:40 
GeneralRe: Array fo MySqlDataAdapter Pin
Tomy140213-Dec-06 17:49
Tomy140213-Dec-06 17:49 
GeneralRe: Array fo MySqlDataAdapter Pin
Andy Brummer13-Dec-06 18:44
sitebuilderAndy Brummer13-Dec-06 18:44 
GeneralRe: Array fo MySqlDataAdapter Pin
Tomy140213-Dec-06 18:49
Tomy140213-Dec-06 18:49 
QuestionHow to establish remote connection Pin
kani9813-Dec-06 13:03
kani9813-Dec-06 13:03 
AnswerRe: How to establish remote connection Pin
Andy Brummer13-Dec-06 17:43
sitebuilderAndy Brummer13-Dec-06 17:43 
AnswerRe: How to establish remote connection Pin
Rob Graham14-Dec-06 4:26
Rob Graham14-Dec-06 4:26 
GeneralRe: How to establish remote connection Pin
kani9814-Dec-06 5:17
kani9814-Dec-06 5:17 
QuestionStored Procedure Pin
tommypa7513-Dec-06 10:52
tommypa7513-Dec-06 10:52 
AnswerRe: Stored Procedure Pin
Private_Void13-Dec-06 11:58
Private_Void13-Dec-06 11:58 
GeneralRe: Stored Procedure Pin
tommypa7514-Dec-06 9:43
tommypa7514-Dec-06 9:43 
QuestionMS-SQL Stored Procedures returning both parameters and recordset Pin
Leo Smith13-Dec-06 8:38
Leo Smith13-Dec-06 8:38 
AnswerRe: MS-SQL Stored Procedures returning both parameters and recordset Pin
Pete O'Hanlon14-Dec-06 0:38
mvePete O'Hanlon14-Dec-06 0:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.