A few weeks ago, I wrote a post about deleting all tables and constraints in a database. It’s time to take that one step further!
The following SQL code will delete all stored procedures, user-defined functions (UDFs), views, table constraints, and tables (in that order) from a given SQL database. As with the original, you can [...]
Popularity: 6% [?]
If you use the ASP.Net membership tools, have <anonymousIdentification enabled=”true” /> specified in your Web.config, and get lots of anonymous visitors, it’s only a matter of time before your database grows. What’s filling it up is the countless user records for your anonymous users.
If you don’t need to track user and profile information for an [...]
Popularity: 13% [?]
We all need to do it from time to time — erase a bunch of tables in a SQL database. Sure, you can do this through Enterprise Manager, one table at a time, or write a bunch of DROP TABLE statements, but when doing it this way, you also need to ensure all foreign key [...]
Popularity: 12% [?]
I just stumbled across the following SQL 2005 code:
BEGIN TRY
UPDATE [tabProgramSite]
SET
[Name] = @ProgramSiteName
WHERE [ProgramSiteID] = @ProgramSiteId
END TRY
BEGIN CATCH
END CATCH
Nothing like catching an error… and doing nothing about it. I hope the user experience isn’t as robust.
Popularity: 22% [?]
Popularity: 22% [?]
There’s one great feature in SQL: the “Generate Scripts” command. Unfortunately, it has one limitation: the default filenames of scripts look something like this:
dbo.fnc_PlayerValue.UserDefinedFunction.sql
dbo.UserSelect.StoredProcedure.sql
I’d much prefer the filenames to match the object name, without the owner (’dbo’) or object type. In other words, I’d prefer the above two files to look like this:
UserDefinedFunction\fnc_PlayerValue.sql
StoredProcedure\UserSelect.sql
How do we [...]
Popularity: 13% [?]