Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
fabianus76
Posting Yak Master
191 Posts |
Posted - 2005-09-20 : 08:12:23
|
Hallo !Right now I am looking for the query-code to delete a table (not only the rows, but all of it). Somebody could give me the code?In general I am always looking for a place on the web, where all sql-server 2005 (express) query-functions are explained. Somebody knows the right place?Thank you very much!Regards, Fabain |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-09-20 : 08:26:17
|
drop table yourtablename |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-20 : 08:57:06
|
"I am always looking for a place on the web"Until 2005 is out of Beta I think you are a bit limited on that score, so my suggestion would be to stick to Books Online (which you can download but then install offline, local to your PC )Kristen |
|
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2005-09-21 : 14:23:18
|
Hallo Kristen, thank you for your help! By the way I tried to Execute this and I get this error : .Net SqlClient Data Provider: Msg 3701, Level 11, State 5, Line 1Cannot drop the table 'xHierarchy_Collection', because it does not exist or you do not have permission.but the table exists for sure and I do have permission (Windows Authentication). Anyway - thank you!Regards, FabianHallo Andrew, do you have any place where actual syntax is explained? I mean for older versions of SQL-Server? This could help me in the mean time I think. Regards, Fabian |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-21 : 15:44:27
|
"but the table exists for sure and I do have permission"And "for sure" you do not!I reckon either:1) You are not connected to the right database2) There is an additional table owned by the user you are logged on as, for which you do not have permissions, and you are intending to drop a table owned by, say, "dbo" instead3) You don't have permissionEither way its all a Right Royal Pain to sort out.My route would be to use Query Analyser (or appropriate tools for SQL 2005 if that's your platform-of-choice).Make sure you connect to your database using the same login as the application (Windows Authentication it seems).Type the exact same command as the application generates (including any table owner etc. that the application would include), but with a transaction block to roll it back - so that you will not actually DROP the table, you just need to find out whether you get an error or not):BEGIN TRANSACTIONDROP TABLE xHierarchy_CollectionROLLBACKand see what happens. Vary the OWNER as appropriateKristen |
|
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2005-09-21 : 17:19:54
|
Hallo Kirsten, you are right! Thank you for having taken the time!I executed the query in the query editor of SQL Express Manager and I did not select the right database at the top dropdown list ;-)Thank you!Regards, Fabian |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-21 : 18:03:52
|
Glad you've got it sorted!Kristen |
|
|
|
|
|
|
|