Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Service Broker / December 2005

Tip: Looking for answers? Try searching our database.

How to detect if an object is existed or not?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Lee - 27 Dec 2005 13:01 GMT
If I create message type more than once (for some reasons), I will get an
error message of "There is already an object named 'xxxxxxxxxx' in the
database.

How to detect if an object is already existed or not?

I try to use 'select Object_ID(xxxxxxxxxx)', but got 'Invalid column name
'xxxxxxxxxx'.
Frank Lee - 27 Dec 2005 13:09 GMT
Well, I use the following statement to prevent create message type more than
one, but still failed.

if Object_ID('HelloWorldRequest') is null
CREATE MESSAGE TYPE [HelloWorldRequest] VALIDATION = NONE

"Frank Lee" <Reply@to.newsgroup> ¼¶¼g©ó¶l¥ó·s»D:eClvtWuCGHA.2316@TK2MSFTNGP12.phx.gbl...
> If I create message type more than once (for some reasons), I will get an
> error message of "There is already an object named 'xxxxxxxxxx' in the
[quoted text clipped - 4 lines]
> I try to use 'select Object_ID(xxxxxxxxxx)', but got 'Invalid column name
> 'xxxxxxxxxx'.
Dan - 27 Dec 2005 13:46 GMT
IF (SELECT name FROM sys.service_message_types
WHERE name = N'HelloWorldRequest' ) IS NULL
CREATE MESSAGE TYPE [HelloWorldRequest] VALIDATION = NONE

Dan

> Well, I use the following statement to prevent create message type
> more than one, but still failed.
[quoted text clipped - 12 lines]
>> I try to use 'select Object_ID(xxxxxxxxxx)', but got 'Invalid column
>> name 'xxxxxxxxxx'.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.