DROP Database Sql Server 2000
Jan 24, 2007
Hi,
i have two servers. database A on server A . database A on server B
(both sql server 2000 - both same d/b - server B being the standy
by).if i delete databse A on server Ai have to deleted the standyby
copy on server B.
can anybody please guide me as to how to do this.
Thanks,
Shark.
View 1 Replies
ADVERTISEMENT
Oct 9, 2006
Hi,I found this SQL in the news group to drop indexs in a table. I need ascript that will drop all indexes in all user tables of a givendatabase:DECLARE @indexName NVARCHAR(128)DECLARE @dropIndexSql NVARCHAR(4000)DECLARE tableIndexes CURSOR FORSELECT name FROM sysindexesWHERE id = OBJECT_ID(N'F_BI_Registration_Tracking_Summary')AND indid 0AND indid < 255AND INDEXPROPERTY(id, name, 'IsStatistics') = 0OPEN tableIndexesFETCH NEXT FROM tableIndexes INTO @indexNameWHILE @@fetch_status = 0BEGINSET @dropIndexSql = N' DROP INDEXF_BI_Registration_Tracking_Summary.' + @indexNameEXEC sp_executesql @dropIndexSqlFETCH NEXT FROM tableIndexes INTO @indexNameENDCLOSE tableIndexesDEALLOCATE tableIndexesTIARob
View 2 Replies
View Related
Sep 6, 2007
Hi,
I am new to SQL Server 2005.Till now, I have been using a SP to execute DROP DATABASE command to drop databases on my existing database server.
but now i want to delete a database which is on a different SQL Server 2005 instance on a different machine. but i am not sure how to do this.
Can anyone please help me on this?
Any help would be appreciated.
Thanx in advance.
Kawal
View 4 Replies
View Related
Jun 27, 2006
I was wondering if anyone may be familiar with a way to create a dropdown list that included a list of SQLServers. Basically I want to create a little application that lets a user point to an instance of sql server, similar to enterprise manager. I wanted to use C# and figured there may be some namespaces I could use that provide this functionality but was not sure.
Thanks,
View 2 Replies
View Related
Mar 15, 2006
How do I drop sql server mobile database at specifical time in my application in PPC?
And, How do I drop it when user input the worng password third times in my application in PPC?
Thank you very much.
View 4 Replies
View Related
Aug 6, 2007
Hi,
We can see current connections while trying to detach the database through SQL server 2005 Management studio.
Is there any way to drop all existing connections to an SQL server 2005 database with out detaching it.
Thanks
View 7 Replies
View Related
Oct 29, 2015
I have an environment with MS-SQL Server 2014 and always-on availability group configured (on 2-nodes).
I'm writing a Powershell Script which removes the database from the availability group (on the primary server) and then SHOULD drop the database on the secondary Server.
That works most of the time, but not always...
When it fails I get the error message:
Cannot drop database "Customer_2" because it is currently in use.
When i check the secondary DB-Server (sp_who2) while the script is running, i see that there is a process for the DB "Customer_2" with Status="background", Command="DB STARTUP" and LastWaitType="REDO_THREAD_PENDING WORK".
As soon as the script fails, this process for "Customer_2" disapears.
This happens always only on the second database in the availability group.
Why is the process still there, even after I removed the database from the Availability Group on the primary node.
If I remove the database from the availability group manually, the "background" process on the secondary node for that database disappears..
[URL]
View 4 Replies
View Related
Dec 6, 2007
I would like to write code to delete and add a SQL Login to every User database on my development server.
Whenever I restore databases to dev using production backups the SQl Server logins are invalid and I need to delete them from the user database and add them again.
I've already hard-coded a sql server job with n steps... a step for each user database to drop and add this sql user to each database. This isn't optimal since I have to add or delete a step everytime a user database is added or deleted.
Does anyone know how to write a loop or cursor that does this dynamically?
I am doing something syntactically wrong related to the GO statement.
declare @db varchar(100)
declare @message varchar(3000)
DECLARE user_cursor CURSOR FOR
SELECT top 1 name
FROM master.sys.databases
where name not in
('master','tempdb','model','msdb')
OPEN user_cursor
FETCH NEXT FROM user_cursor INTO @db
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @message = 'use '+@db + '
GO'
+'DROP USER [SQLLogin.DataEntry]
CREATE USER [SQLLogin.DataEntry] FOR LOGIN [SQLLogin.DataEntry]
EXEC sp_addrolemember N''db_datareader'', N''SQLLogin.DataEntry''
GO
'
execute @message
print @message
FETCH NEXT FROM user_cursor INTO @db
END
CLOSE user_cursor
DEALLOCATE user_cursor
View 3 Replies
View Related
Sep 13, 2006
How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
I tried using DROP Tables, Truncate Database, Delete and many more but it is not working. I want to delete all tables using Query Analyzer, i.e. through SQL Query.Please help me out in this concern.Nishith Shah
View 34 Replies
View Related
Feb 2, 2007
I am executing
DROP INDEX [IX_Users] ON [Users]
and i get a syntax error
what is the exact syntax to DROP an INDEX for MS SQL 2000
thank you
View 3 Replies
View Related
Oct 18, 2007
Hi all,
We are in the process of upgrading a sql 2000 database over to 2005 and have noticed some substancial performance drops with scalar udfs in 2005.
I have already read the following post
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=491984&SiteID=1
and recognise that udfs are not the most performant option in the first place, but was surprised how much slower these have become on 2005.
Has anyone else had this sort of issue, we really don't want to go away from the udf's but would like to know if there is a design issue within a udf that might be causing this (or even a usage issue). What I am getting as is: Is there certain types of queries, or keywords that should be avoided in udfs on 2005?
A simple example we have is a udf that returns an exchange rate stored in the db, this has parameters of "from currency", "to currency", and date.
SET @ret = ( SELECT TOP 1 TELE_TRANSFER_RATE
FROM dbo.EXCHANGE_RATES
WHERE EXCH_CURRENCY_NO = @from
AND CURRENCY_NO = @to
AND RATE_DATE <= @date
ORDER BY RATE_DATE DESC )
RETURN @ret
And then this is called from a script that returns financials, standard select statement, with udf call in select clause.
Any comments?
Thanks in advance.
Clint Colefax
View 6 Replies
View Related
Oct 30, 2007
Problem description
There are two sql servers with the same database in different locations with replication running on them. Users in the two locations insert or update date on there own database through an ms access application . The data are replicated to both servers.
Someone wanted a copy of the database and they dropped replication, but users continue to modify and add data on both servers and so replication could not be back again without merging the two databases as one again and restarting replication.
My job was to merge the databases and make replication work and after allot of work all is fine.
I copy and attached the database on my pc that I set up as a server and did the job. Then I went back on both servers that had replication running before I attached the database and set the subscriber and publisher and all was fine to that point.
The database has six groups with permissions on them and many database users on each location. Both the groups and the users show on the database.
I create a new login and user and I add him to the groups to get the permissions.
Now back on a user pc I login with the new user name run the ms access application and try to add some new records, but I get errors that I cannot insert null values to two of the fields in several tables in the database.
This was not happening before and the database was recording the values in those fields namely the user name and the date that the new record was created.
After some reading I found out that I might need to set the groups and permissions on the views and tables from the beging but Im not an expert.
Any ideas?
Thanks allot
George
View 1 Replies
View Related
Aug 31, 2000
I am trying to delete a database that is labeled suspect. Is there a way to force a drop of a database? It is shows it is marked inaccessible when trying to delete.
Thanks, Steve
View 1 Replies
View Related
Nov 20, 2007
anyone know how to drop my databse on sql pleasee
charles
View 8 Replies
View Related
Jul 23, 2005
I am trying to drop a database, but keep getting the following error."cannot drop database 'blah' because it is currently being used forreplication".This db is not currently being replicated, but once was. It is thesubscriber side of an old replication pair.Can anyone tell what I have to do to make this go away?Thanks,TGru*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 1 Replies
View Related
Jul 20, 2005
Hello everyone!I'm from El Salvador and i have a problem, i have a sybase systemrunning on windows 2000 server, probably a programmer drop adatabase...but i dont know who did it?, is it possible to know who dropthe database?, if the answer is yes... plese help me, because we need tosolve this security problem in our company.Sybase saves all the TSQL and transaction somewhere?,Saludos....--Posted via http://dbforums.com
View 1 Replies
View Related
Dec 12, 2006
I am trying to move a database which I wrote in SQL Server 2005 to a SQL Server 2000 database.
I'm not sure the best way to do this.......
Can anyone enlighten me?.....
View 4 Replies
View Related
Jan 25, 2007
I am working on a project that was written in Visual Studio 2003 using asp.net and C#. The project accesses a SQL Server 2000 database. I need to test the application. What I want to do is to copy the database over to a test server. The problem is that the test server only has SQL Server 2005 on it. Would it be a problem if I backed up the database using SQL Server 2000 and then recreated it on the server as a SQL server 2005 project? Would my source code accept the new database even though it would now be in sql server 2005?
View 2 Replies
View Related
Apr 25, 2007
what is the sql query to drop all tables in a database in sql server 2000
View 5 Replies
View Related
Jul 9, 2004
Hi everybody,
I would like to know if there would be any special way to force drop a database from an ASP.NET page.
When I try to do it in the normal way, it gives me an exception like: Cannot drop the database 'xxxxxxx' because it is currently in use. I'would have to wait until there is a timeout.
In fact that database can be accessed from another pages, but I want to know if I'd be able to force drop database even when another pages are using it.
Thanks in advance
View 3 Replies
View Related
Feb 14, 2006
I'd like to write a stored procedure to drop all objects in a SQL Server 2000 database owned by a particular uid. Originally I'd hoped to use these two stored proc built-ins for the task: sp_MScheck_uid_owns_anything (to get a list of all objects owned by a uid) and sp_MSdrop_object (to drop the objects). I've run into a few problems along the way:
1. If I run this command
EXEC sp_MScheck_uid_owns_anything 5
I get this weird error message:
"The user owns objects in the database and cannot be dropped."
Not sure why that is since I'm just trying to list the objects, not drop them.
2. I tried running a simple query to get the objects from the system table instead:
SELECT * from [dbo].[sysobjects] where uid = 5
This returns a resultSet as you'd expect. When I wrote a stored procedure to loop through these and use sp_MSdrop_object it seemed to fail whenever it encountered a foreign key object. Here is the error message:
The request for procedure 'name of foreign key' failed because 'name of foreign key' is a unknown type object.
Can anyone give advice as to the best way to go about doing this? I'd really prefer not to have to drop the entire database and recreate it. Thanks!
-Cliff
View 7 Replies
View Related
Feb 1, 2007
I have a list of 35 tables that need to drop the primary key index from in my database.
My problem is as follows for these 35 tables:
1. How can I get a list of all the primary keys for this subset of tables in my database
2. How can I drop just the PK for each of these tables?
I want an easy quick way to do this without having to manually do this for each of the 35 tables in my database. I dont want to do this for all tables just the subset.
Thanks
View 9 Replies
View Related
Apr 6, 2004
How can I drop all the indexes in all the tables in a MS 2000 SQL Server?
View 9 Replies
View Related
Jun 2, 2008
Hi i m Uday,i want to delete ie Drop a database from specified location
for this i used this query as
DROP DATABASE AdventureWorks1,'C:Sql_dB_creatorsqlDB_creatorApp_DataAdventureWorks1'
but i gives incorrect syntax error.
So plz give the sql query to Drop a Database from specified path
Thank You
uday
View 3 Replies
View Related
Feb 3, 2006
Does anyone happen to have a script that will drop all database objects?
I'm looking for something generic that will work with any SQL Server 2000 database. I can write one myself, but I thought I would check here first.
Thanks in advance
John
View 2 Replies
View Related
Jul 26, 2007
Hi All,
I use SQL SERVER 2005 and SQL SERVER Mobile.
My SQL Server I created publication, and on mobile subscriber and did web Synchronization , no problem.
I deleted publication from under Local Publication with SQL SERVER Managment Studio.
and now I want drop database, I get this error "Drop failed for Database DBNAME ... Cannot drop database DBNAME because it is being using Replication"
How to I drop this database ?
And where registred this replication information ?
Regards,
Mahir Quluzade
View 1 Replies
View Related
Oct 12, 2005
I can not delete user from a database in sql2005 beta 3.
View 22 Replies
View Related
Jul 12, 2006
when I do DROP DATABASE I'm getting errors because it's in use. But if I do a delete from the mgmt studio gui I have the option to close all connections as part of the delete. Is there a way to achieve the same effect from a sql script?
View 7 Replies
View Related
Jun 22, 2006
Hey everyone.
View 2 Replies
View Related
May 3, 2005
Hi everybody,
I am using VB Webforms as my front end and MSDE 2000 as my back end. I am not able to drop a database after executing the following vb code on that database:
Dim vConnection As New SqlConnection(vConnectionString) Dim vAdapter As New SqlDataAdapter("SELECT party_type_code, party_type_name, party_type_imported" & _ " FROM Party_Type" & _ " ORDER BY party_type_name", vConnection) Dim vDataTable As New DataTable() vAdapter.Fill(vDataTable) vAdapter.Dispose() vConnection.Dispose()
On trying to drop the database using the SQL Command "DROP DATABASE PPCABCD2005", I get the error message:Cannot drop the database 'PPCABCD2005' because it is currently in use ...However, if I don't execute the above code, I am able to drop it. Why is it so? What is the solution to this problem?
View 2 Replies
View Related
Nov 25, 2005
Third question:
I'm backing up a database which has some users.
When I try to restore it to another machine which has the same users and already has an old version of the database the database cannot be accessed. I must drop the users from the database by using the stored procedures sp_dropuser <username> and then add it again to the database from the Enterprise Manager.
Why this happens??
Regards,
Manolis
View 1 Replies
View Related
Apr 10, 2004
Hi,
Any body please give me any reference to the C# code, how to drop a database on SQL SERVER CE.
thanx and regards
ramesh chandra
View 1 Replies
View Related
May 1, 2008
I am trying to drop a login but the system is telling me.
quote:Msg 15174, Level 16, State 1, Line 3
Login 'Mark' owns one or more database(s). Change the owner of the database(s) before dropping the login.
Question:
But how do i check to find out which objects or tables that this login is associated with.
Dallr
View 6 Replies
View Related