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 |
|
yossibaram
Yak Posting Veteran
82 Posts |
Posted - 2002-11-20 : 03:21:16
|
| Hi,Can i Creat a table using stored procedure, when the fields of the new table type and length will be set dynamicly?ThanksYossi |
|
|
rickratayczak
Starting Member
5 Posts |
Posted - 2002-11-20 : 03:57:35
|
| Yes, you can use the exec function. Example:declare @SQL as varchar(3000)set @SQL = 'create table hello { INSERT CODE HERE }'exec @SQL |
 |
|
|
yossibaram
Yak Posting Veteran
82 Posts |
Posted - 2002-11-20 : 04:11:36
|
What i realy ment was to get the names, type and length of each field as the input parameters of the stord procedure.Ex:CREATE PROCEDURE NewTable @col1,@Type1,@length1,@col2....etcASdeclare @SQL as varchar(3000)set @SQL = 'create table hello { @col1 @type1 ......}I can't work it out, Can it be done? My problem is that the fields are modified only at run time from the client application.ThanksYossiquote: Yes, you can use the exec function. Example:declare @SQL as varchar(3000)set @SQL = 'create table hello { INSERT CODE HERE }'exec @SQL
|
 |
|
|
Bambola
Posting Yak Master
103 Posts |
Posted - 2002-11-20 : 09:21:02
|
| you can pass to the stored procedure a delimited string containing all the data, than inside the stored procedure parse it using a UDF and construct your string.Bambola. |
 |
|
|
|
|
|