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
 General SQL Server Forums
 New to SQL Server Programming
 Create table using function

Author  Topic 

goodman2253
Yak Posting Veteran

88 Posts

Posted - 2011-11-30 : 04:19:40
Hi can anybody help me
how to create tables using procedure in sql server 2005

every time when i called the procedure table should be formed and i should insert the data in that table and after that i select the reult in a file and then after that i sholud drop the table

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-30 : 05:32:44
function/procedure.

What do you want and what have you tried.
More specifically what are you trying to do - can't see a use for creating a table in a procedure like this.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jassi.singh
Posting Yak Master

122 Posts

Posted - 2011-11-30 : 06:41:13
Please provide us what you have tried

some hints for you:
1)Create temp table
2)insert data into temp table
3)export data from temp table to file i.e table to csv
4)finally as it is temp table it will get dropped automatically
Go to Top of Page

goodman2253
Yak Posting Veteran

88 Posts

Posted - 2011-12-01 : 08:08:25
when t call the procedure/function the table sould be created.
how to do that
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-12-01 : 08:25:44
Just use the create table function. Does it matter if others might call it a statement?


or

create proc s_CreateTable
as
exec ('create table mytable (i int)')
go

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

goodman2253
Yak Posting Veteran

88 Posts

Posted - 2011-12-03 : 11:21:37
Thanks..
Go to Top of Page

goodman2253
Yak Posting Veteran

88 Posts

Posted - 2011-12-03 : 11:26:05
Thanks..
Go to Top of Page
   

- Advertisement -