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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 find the table existanc before creating table

Author  Topic 

ashishmishra81
Starting Member

5 Posts

Posted - 2008-04-22 : 08:43:26
hello friends,

i want to create a store procedure that automatically create a table ,
i want that it before creating a table it check whether a that table is exist or not
please help me as soon as posible

sonu

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-22 : 08:52:47
SELECT * FROM INFORMATION_SCHEMA.TABLES



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-22 : 09:08:51
quote:
Originally posted by ashishmishra81

hello friends,

i want to create a store procedure that automatically create a table ,
i want that it before creating a table it check whether a that table is exist or not
please help me as soon as posible

sonu


Why do you want to create tables automatically?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ashishmishra81
Starting Member

5 Posts

Posted - 2008-04-22 : 09:33:52
quote:
Originally posted by madhivanan

quote:
Originally posted by ashishmishra81

hello friends,

actually i want to make a chat utility where each user want to do chat.
if they wish to chat then at that moment a message table(table name is user's id in master table)is created dynamically




i want to create a store procedure that automatically create a table ,
i want that it before creating a table it check whether a that table is exist or not
please help me as soon as posible

sonu


Why do you want to create tables automatically?

Madhivanan

Failing to plan is Planning to fail



sonu
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-04-22 : 16:23:32
Again, why do you want to create tables automatically??

Terry
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-04-22 : 17:01:24
quote:
Originally posted by tosscrosby

Again, why do you want to create tables automatically??

Terry



Because s/he's a rocket scientist



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

chandan_joshi80
Starting Member

30 Posts

Posted - 2008-04-24 : 07:42:07
alter PROCEDURE general_select1
(
@col1 varchar(20)
)
AS
DECLARE @sql nvarchar(4000)
SELECT @sql = 'CREATE TABLE K('+@col1+' VARCHAR(20) )'
EXEC sp_executesql @sql


exec general_select1 'orderid'

ACTUALLY I HAVE CREATED IT DYNAMICALLY

chandan Joshi
Go to Top of Page
   

- Advertisement -