Hi.. friends,
Its so simple
first of all use this code to write xml file using dot net
using system.Data
using System.Data.SqlClient
Dataset ds=new Dataset()
sqlDataAdapter da=new sqldataadapter("select * from tablename",connectionstring)
da.fill(ds)
ds.writexml("filename")
now Suppose the name of file is abc.xml
and if you want to convert this xml file into table format and insert its values into another table then use the sql server 2005 this procedute........
create proc xyz @xmldoc varchar(max)
as declare @ihandle int
exec Sp_Xml_PrepareDocument @ihandle output, @xmldoc
select * into #tablename1 from openxml(@ihandle,'/newdataset/tablenameofdataset',2) with
( columnname datatypes(size) ,.......)
insert into tablename(columnname.......) select columnname,......... from #tablename1
using this code you can convert xml file into table format after that insert into database
xmdoc is the variable where pass the xml file as a string abd in openxml ()pass 3 argument first is handler sendone isxmlfile firsttablename and third one is 2 and after the with specify all columnsname and datatypes of the table. after that you can do this.
Dot Net Developers Help
This blog is help full for the Dot Net as well as SQL 2005/2008 developers. Its help language like c-sharp, vb.net. and help for creating procedure, trigger, cursor, DDL and DMLcommands.
Friday, November 12, 2010
How to get all datatypes of sqlserver 2005
Use the command........
Select * from sys.types
To get all column information of database then use the
select * from information_schema.columns
Select * from sys.types
To get all column information of database then use the
select * from information_schema.columns
Subscribe to:
Comments (Atom)