| Author |
Topic |
|
jsc0624
Starting Member
13 Posts |
Posted - 2007-04-24 : 02:53:21
|
What is wrong with the following command? create database SuppliersDatabasecreate table tblWarrantyClause( WarrantyID int, Warranty char(100), WarrantyPeriod int, Coverage char(100), ReplacementPeriod int, ReplacementPeriodUnit char(50), DocRef char(100), ReferencePage char(10), ReferenceSection char(10), ContractID_fk int ); I just wondering where can I find the table of my database SuplliersDatabase. I need to know if it is already exists or not? I tried to look around but then still I can't find it.===============JSC0624=============== |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-24 : 03:09:48
|
| What is the error you get? It should be self-explained.Also look in Books Online for syntax using CREATE DATABASE.Have you tried with a simlpe GO statement between the two commands?Peter LarssonHelsingborg, Sweden |
 |
|
|
jsc0624
Starting Member
13 Posts |
Posted - 2007-04-24 : 03:18:25
|
| I want to know if my table in the database is already existing. Actualy there is no actual error occurred, but then I just wondering why I can't view the table created and its' corresponding fields. Only the database is available in object browser, but where is the table? So, if I tried again to run the command there is a message that says, "There is already an object named 'tblWarrantyClause' in the database. But, where it is? I can't find it? Please help, I don't have any idea if the above commands really works or not.===============JSC0624=============== |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-24 : 03:27:17
|
| IF OBJECT_ID('mytable) IS NOT NULL DROP table mytablePeter LarssonHelsingborg, Sweden |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-24 : 03:37:48
|
quote: Originally posted by jsc0624 What is wrong with the following command? create database SuppliersDatabaseGOUSE SuppliersDatabaseGOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblWarrantyClause]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[tblWarrantyClause]GOcreate table dbo.tblWarrantyClause( WarrantyID int, Warranty char(100), WarrantyPeriod int, Coverage char(100), ReplacementPeriod int, ReplacementPeriodUnit char(50), DocRef char(100), ReferencePage char(10), ReferenceSection char(10), ContractID_fk int ) GOI just wondering where can I find the table of my database SuplliersDatabase. I need to know if it is already exists or not? I tried to look around but then still I can't find it.===============JSC0624===============
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jsc0624
Starting Member
13 Posts |
Posted - 2007-04-24 : 03:40:43
|
If I tried this code there is an error message that says, "Server: Msg 207, Level 16, State 3, Line 15"IF OBJECT_ID('mytable) IS NOT NULLDROP table mytable ===============JSC0624=============== |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-24 : 03:43:25
|
| Oops. Missing a single quote character.Use Harsh's suggestion.Peter LarssonHelsingborg, Sweden |
 |
|
|
jsc0624
Starting Member
13 Posts |
Posted - 2007-04-24 : 03:48:24
|
| Hi Harsh Athalye!Your code works but then how can I view the created table sitting inside my Suppliers database using the SQL Manager.===============JSC0624=============== |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-24 : 03:51:38
|
SQL manager? I believe you mean Enterprise Manager.You can expand the Suppliers database you just created and click on the tables node under it to see the table.From Query Analyzer(QA), just type in:USE SuppliersDatabaseGOEXEC sp_help 'tblWarrantyClause' and press F5 to view table structure.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jsc0624
Starting Member
13 Posts |
Posted - 2007-04-24 : 09:19:14
|
| Thanks to both of you harsh athalye and peso.===============JSC0624=============== |
 |
|
|
|