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 |
|
muvvasiva
Starting Member
14 Posts |
Posted - 2009-06-01 : 07:37:35
|
| Hi All, I need to write a stored procedure with the following functionality.-->To insert data into any table(all tables are in same schema) i use only this procedure-->But this procedure should contain only one insert statement I pass table name and values as input parametersActually i don't know ,it's possible or not pls help me |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-01 : 07:50:36
|
Only ONE procedure for inserting into any table? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
muvvasiva
Starting Member
14 Posts |
Posted - 2009-06-01 : 07:56:24
|
| yes ,only one procedureAnd Procedure also should contain only one insert statement |
 |
|
|
muvvasiva
Starting Member
14 Posts |
Posted - 2009-06-01 : 08:07:14
|
| SET @query ='INSERT INTO '+@tableName+'('+substring(@string,0,len(@string)) + ') VALUES(' + CONVERT(NVARCHAR(255),@j)+','+@k+','+@l+')'there are two parts in the above insert statementupto values(' it is ok.but the problam is to convert the data types variables dynamically |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2009-06-01 : 08:45:24
|
| Why on earth would you want to do this? |
 |
|
|
|
|
|