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 |
delux269
Starting Member
2 Posts |
Posted - 2010-06-28 : 08:38:57
|
The following syntax is throwing an error in C#:"USE database2 " +"UPDATE table1 SET CRTD_PROG = 'PR00' , TAXCAT = '001', CLASSID = 'MATRL', COGSACCT = '53000', COGSSUB = '9999', COUNTSTATUS = 'A', DFLTPOUNIT = 'EACH', DFLTSALESACCT ='53000', DFLTSALESSUB = '9999', DFLTSOUNIT = 'EACH', INVTACCT = '53000', INVTSUB = '9999', INVTTYPE ='C', VALMTHD = 'F', TRANSTATUSCODE = 'AC', PPVACCT = '53000', PPVSUB = '9999', SOURCE = 'P', STKUNIT = 'EACH', IRCALCPOLICY = 1, PERNBR = '201005', REPLMTHD = 0, AUTOPOPOLICY = 'N', CHKORDQTY = 'N'" +"where CRTD_prog <> 'PR00'" +"INSERT INTO [database1].[dbo].[table1] ([ABCCode],......)" + "SELECT B.[ABCCode]........" + "FROM [database2].[dbo].[table1] AS B" +"left join [database1].[dbo].[table1] as A" +"on (a.INVTID) = (b.INVTID)" +"where" +"a.INVTID is null";The error is thrown by the "." in the "SELECT B." statement, and the ")" in the "INSERT INTO......)" statement |
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-06-28 : 09:27:58
|
Great, thanx for letting us know.- LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-06-28 : 09:30:48
|
But seriously; show us what the query looks like when you print it to the screen by doing a console.writeline(query) or something...it will probably be quite obvious what's not working.- LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
delux269
Starting Member
2 Posts |
Posted - 2010-06-28 : 10:06:02
|
The error message is now telling me "B.[ABCCode]" cannot be bound. Could this be a permissions issue with access to the database? |
 |
|
Kbalz
Yak Posting Veteran
94 Posts |
Posted - 2010-06-29 : 11:05:13
|
Try select B.[ABC] FROM [db2].[dbo].[table1] BThis will confirm your permissions on that table.Your problem might be your .NET string doesn't have spaces after each line.. and concatenating in .NET makes the overall string bad. |
 |
|
|
|
|
|
|