Author |
Topic |
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-09-20 : 12:55:48
|
I am having this query select * into tbl_amazon_merchant from tbl_master_merchant where merchant='Amazon.com' and updated_date=getdate()this works nicely...But my need is I am going to create this query using dynamic table creation as like this ..SET @sql ='select * into tbl_'+@Ch_BoxList+'_merchant from tbl_master_merchant where Merchant =' +@Ch_BoxList+ ' and updated_date=getdate()'EXEC (@sql)When executing this query i received this error ..Msg 4104, Level 16, State 1, Line 1The multi-part identifier "Amazon.com" could not be bound.Pls help me tnx in advance.... |
|
Sachin.Nand
2937 Posts |
Posted - 2010-09-20 : 13:02:31
|
quote: Originally posted by jafrywilson I am having this query select * into tbl_amazon_merchant from tbl_master_merchant where merchant='Amazon.com' and updated_date=getdate()this works nicely...But my need is I am going to create this query using dynamic table creation as like this ..SET @sql ='select * into tbl_'+@Ch_BoxList+'_merchant from tbl_master_merchant where Merchant =' +@Ch_BoxList+ ' and updated_date=getdate()'EXEC (@sql)When executing this query i received this error ..Msg 4104, Level 16, State 1, Line 1The multi-part identifier "Amazon.com" could not be bound.Pls help me tnx in advance....
Can you find something fishy in the above red part?PBUH |
 |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-09-20 : 13:08:43
|
Hey Sachin.Nand that is no probs...tbl_Amazon.com_merchant will be created instead of tbl_amazon_merchant ... |
 |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-09-20 : 13:11:58
|
When i execute the first query i didn't get error... But executing(by passing Amazon.com for @Ch_BoxList) the second query i got error |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-09-20 : 13:22:24
|
What happens if you assign @Ch_BoxList with Amazon instead of Amazon.com ?PBUH |
 |
|
namman
Constraint Violating Yak Guru
285 Posts |
Posted - 2010-09-20 : 13:23:39
|
quote: SET @sql ='select * into tbl_'+@Ch_BoxList+'_merchant from tbl_master_merchant where Merchant =' +@Ch_BoxList+ ' and updated_date=getdate()'EXEC (@sql)
Miss single quote.Try this ...SET @sql ='select * into tbl_'+@Ch_BoxList+'_merchant from tbl_master_merchant where Merchant =''' +@Ch_BoxList+ ''' and updated_date=getdate()'EXEC (@sql) |
 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-09-20 : 13:27:51
|
quote: Hey Sachin.Nand that is no probs...tbl_Amazon.com_merchant will be created instead of tbl_amazon_merchant ...
if this table tbl_Amazon.com_merchant gets created, it will live in the tbl_Amazon schema and be called com_merchant. Is this what you intend?JimEveryday I learn something that somebody else already knew |
 |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-09-20 : 13:46:38
|
quote: Originally posted by jimf
quote: Hey Sachin.Nand that is no probs...tbl_Amazon.com_merchant will be created instead of tbl_amazon_merchant ...
if this table tbl_Amazon.com_merchant gets created, it will live in the tbl_Amazon schema and be called com_merchant. Is this what you intend?JimEveryday I learn something that somebody else already knew
Ya ..I received this error ..What can i do now.. |
 |
|
X002548
Not Just a Number
15586 Posts |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-09-20 : 14:51:22
|
This is not OLTP .. It is just a small application... |
 |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-09-20 : 18:11:06
|
Tnx for response... |
 |
|
|