Last Updated on Monday, 05 November 2012
Some people have been suggesting you can use "CREATE OR REPLACE ... VIEW ... FUNCTION" but my SQL Server 2008 Management Studio doesn't like this and refuses to understand what I'm trying to do.
Why?
As this data seemed to be across various websites, I wanted a page which has all of them in one place. So here you go, I hope it's of some use. If it's wrong then just post a comment at the bottom of this page.
Go go go
Note that in the following examples, I'm checking under the [Common] schema, this might be [dbo] for you or a more specific one.
- -- drop a stored procedure if it exists
- IF OBJECT_ID ( '[Common].[usp_MyStoredProcedure]', 'P' ) IS NOT NULL
- DROP PROCEDURE [Common].[usp_MyStoredProcedure];
- GO
- -- drop a view if it exists
- IF OBJECT_ID ( '[Common].[uvw_MyView]', 'V' ) IS NOT NULL
- DROP VIEW [Common].[uvw_MyView];
- GO
- -- drop a function if it exists
- IF OBJECT_ID ( '[Common].[ufn_MyFunction]', 'FN' ) IS NOT NULL
- DROP FUNCTION [Common].[ufn_MyFunction];
- GO
- -- drop a user table if it exists
- IF OBJECT_ID ( '[dbo].[myUserTable]', 'U' ) IS NOT NULL
- DROP TABLE [dbo].[myUserTable];
- GO
Types for sys.objects (less used by me)
- AF = Aggregate function (CLR)
- C = CHECK constraint
- D = DEFAULT (constraint or stand-alone)
- F = FOREIGN KEY constraint
- FN = SQL scalar function
- FS = Assembly (CLR) scalar-function
- FT = Assembly (CLR) table-valued function
- IF = SQL inline table-valued function
- IT = Internal table
- P = SQL Stored Procedure
- PC = Assembly (CLR) stored-procedure
- PG = Plan guide
- PK = PRIMARY KEY constraint
- R = Rule (old-style, stand-alone)
- RF = Replication-filter-procedure
- S = System base table
- SN = Synonym
- SQ = Service queue
- TA = Assembly (CLR) DML trigger
- TF = SQL table-valued-function
- TR = SQL DML trigger
- TT = Table type
- U = Table (user-defined)
- UQ = UNIQUE constraint
- V = View
- X = Extended stored procedure
Latest Posts
-
Joes Quicklist Weblinks (JQW)
-
Tue 18-Jun-13
Hi Joel, Great module, it really fills a need, and I'm not even using the thumbnails. It doesn't seem ...
-
Tue 18-Jun-13
-
Migrate Joomla! 1.5.x to 2.5.x+
-
Fri 07-Jun-13
Hi Drew, I've got a silly question, are you sure the template you are using has been upgraded or ...
-
Wed 05-Jun-13
Joel, Thanks for the newly updated instructions. I was nearly successful in getting everything working.
-
Wed 05-Jun-13
Hi Drew, Good point. You need to copy your images folder from your old site over to your new one. You ...
-
Tue 04-Jun-13
Making a little progress here. I already had a copy of the live site running on this test server. So ...
-
Fri 07-Jun-13

