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 |
|
khalik
Constraint Violating Yak Guru
443 Posts |
Posted - 2009-01-23 : 07:22:23
|
| hi When i execute a query with For XML clause it add a 'T' between data and time. can this be avoided.LastUpdated="2008-08-09T04:28:57.333"also one more i created a tablecreate table testxml(id int ,data xml)insert into testxml(1,<01card CardID="1" CardName="AccountCategory" CardDescription="Account Category"/>)i get an error Incorrect syntax near '<'.how do i insert data in xml column.Thanks========================================Project Manager who loves to code.===============Ask to your self before u ask someone |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-23 : 07:31:52
|
| u can avoid 't' by converting into 121 style using convert function |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-23 : 09:39:03
|
quote: Originally posted by khalik hi When i execute a query with For XML clause it add a 'T' between data and time. can this be avoided.LastUpdated="2008-08-09T04:28:57.333"also one more i created a tablecreate table testxml(id int ,data xml)insert into testxml(1,<01card CardID="1" CardName="AccountCategory" CardDescription="Account Category"/>)i get an error Incorrect syntax near '<'.how do i insert data in xml column.Thanks========================================Project Manager who loves to code.===============Ask to your self before u ask someone
for insertion,just insert like varcharinsert into testxml(1,'<01card CardID="1" CardName="AccountCategory" CardDescription="Account Category"/>') |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-23 : 10:13:40
|
quote: Originally posted by visakh16
quote: Originally posted by khalik hi When i execute a query with For XML clause it add a 'T' between data and time. can this be avoided.LastUpdated="2008-08-09T04:28:57.333"also one more i created a tablecreate table testxml(id int ,data xml)insert into testxml(1,<01card CardID="1" CardName="AccountCategory" CardDescription="Account Category"/>)i get an error Incorrect syntax near '<'.how do i insert data in xml column.Thanks========================================Project Manager who loves to code.===============Ask to your self before u ask someone
for insertion,just insert like varcharinsert into testxml(1,'<01card CardID="1" CardName="AccountCategory" CardDescription="Account Category"/>')
Hi Visakh,missing VALUES in insert statementinsert into testxml VALUES (1,'<01card CardID="1" CardName="AccountCategory" CardDescription="Account Category"/>')Morover even after adding Values Keyword Msg 102, Level 15, State 1, Line 1Incorrect syntax near ')'.It is displaying error message as above |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-23 : 10:33:21
|
| thats because the xml is not well formed. the posted xml is not correct. try a valid xml and it will work. |
 |
|
|
|
|
|
|
|