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 |
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2006-08-18 : 06:21:51
|
| how do i check for the existence of an object(Ex: a table) in my database? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-08-18 : 06:33:50
|
| select * from sysobjectsPeter LarssonHelsingborg, Sweden |
 |
|
|
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2006-08-18 : 06:33:52
|
| i think this is to do with something like:if exists(select ... from sysobjects where ...)hope this guides you properly. |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-08-18 : 07:16:13
|
| [code]if objectproperty(object_id('dbo.MyTable'),'IsUserTable') = 1 begin .. do something if it exists ... end[/code]CODO ERGO SUM |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2006-08-18 : 09:03:07
|
quote: select * from sysobjects
Thats not funny For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-08-18 : 11:49:41
|
| or make use of Information_schema viewsIf exists(Select * from Information_schema.tables where table_name='name')MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|