Best XML Structure For Import Into SQL 2005
May 11, 2007
Hi,
I am writing a contingency plan for incase our SQL Server (2005) goes down. Basically when our applicatino is about to write data to the SQL Server it checks the connection. If the connection passes it outputs to SQL, if it fails it generates an XML document detailing the data so that the data can be imported later.
Each XML document needs to define which database and which table needs to be updated/inserted.
So the SQL needs to be able to read a number of XML documents and update the relevant tables according dependent on the data held within the XML; some examples:
<Output>
<Record>
<Database>DW</Database>
<Table>dbo.tblActivity</Table>
<DateTime>11-05-2007 10:03:33.099</DateTime>
<Data>
<strActivityPK>9353|HCR008</strActivityPK>
<strActivityCode>HCR008</strActivityCode>
<strActivityDescription>HCR Complete</strActivityDescription>
<datTarget>2007-05-18</datTarget>
<datActual />
<intMatterIntCode>9353</intMatterIntCode>
<intRecurringActivityFlag>0</intRecurringActivityFlag>
<intETLFlag>0</intETLFlag>
</Data>
</Record>
</Output>
I need SSIS to open this XML, read the Table element and insert or update dbo.tblActivity (in this case) with the data defined in the Data element. If updating, the update should only take place if the DateTime is more recent than a field (datLastUpdate) on the corresponding row in the database.
Can anyone offer some guidance (for example is the XML optimally structured for import by SQL) and advice on how (which tasks to use) to go about setting this SSIS package up.
Ps. thanks to Darren I already have the file selection and open process sorted using a Foreach and some enumeration to select each XML file. It is what to do with the XML afterwards I need get working...
Thanks,
Drammy
View 6 Replies
ADVERTISEMENT
Jan 18, 2007
I need to be able to import a directory file list into a sql table.
i.e. table contains fields for filename, date etc...
is this possible?
thanks?
View 9 Replies
View Related
Jan 23, 2008
Hi,
As stated in the subject, I need to import a complete directory structure, from a root folder that I specify into a SQL Server database. To add further complexity, I also need to see what files exist in each directory.
At the end of the day what I am trying to achieve is to populate a table that will essentially have two columns, the filename and the directory that the file resides in. I am running SQL Server 2005.
Has anybody ever done anything like this before using T-SQL?
Thanks in advance.
View 5 Replies
View Related
Apr 24, 2006
Hello,
I'm looking for an example on how to import a Flat file that is not a csv file but had data on several lines, a small indicator at the beginning of the line indicates what kind of data is on the rest of the line. Not every field is availabye for each block.
Anybody got an idea on where to find this kind of samples.
Thx.
View 3 Replies
View Related
Apr 23, 2008
Hello,
I would like to ask you if there is better to recreate database structure on 2005 from 2000 and move data or to just load
2000 backup.
Currently I loaded the backup, but I am wondering if there might be slightly better performance on 2005 when recreating structure on 2005 to loading 2000 backup?
Does loading 2000 backup create 2005 binary structure?
Thanks for help in advance
View 5 Replies
View Related
Mar 31, 2007
I is possible to copy the structure of an existing SQL 2000 table to make a new table with Visual Studio 2005?
View 2 Replies
View Related
Jun 16, 2005
does anyone know how to modify table structure in sql server management console(2005)? thanks
View 1 Replies
View Related
Jul 20, 2005
Hi,I'm using DB2 UDB 7.2.Also I'm doing some tests on SQL Server 2000 for some statements touse efectively.I didn't find any solution on Sql Server about WITH ... SELECTstructure of DB2.Is there any basic structure on Sql Server like WITH ... SELECTstructure?A Sample statement for WITH ... SELECT on DB2 like belowWITHtotals (code, amount)AS (SELECT code, SUM(amount) FROM trans1 GROUP BY codeUNION ALLSELECT code, SUM(amount) FROM trans2 GROUP BY code)SELECTcode, SUM(amount)FROM totalsGROUP BY code.............................Note: 'creating temp table and using it' maybe a solution.However i need to know the definition of the result set of Unionclause. I don't want to use this way.CREATE TABLE #totals (codechar(10), amount dec(15))GOINSERT INTO #totalsSELECT code, SUM(amount) FROM trans1 GROUP BY codeUNION ALLSELECT code, SUM(amount) FROM trans2 GROUP BY codeGOSELECT code, sum(amount) FROM #totals GROUP BY codeGOAny help would be appreciatedThanks in advanceMemduh
View 3 Replies
View Related
Oct 22, 2007
I am trying to import Access reports using Visual Studio 2005 and Access 2007. SQL Server 2005 with Reporting Services is also installed. I select Reports in the Solution Explorer and then Import Reports... Microsoft Access and browse to my Access database. After I select the database I see it open briefly as if it is trying to import the reports but then Access quickly closes and a error pops up: "You already have the database open." I have checked and double checked and the database is not open. I have even tried several different databases and the same errror occurs. Any help would be greatly appreciated.
View 1 Replies
View Related
Jun 20, 2008
1) I can't get the 'copy database' function to work from SQL Server 2008 to SQL Server 2005. I connect ok. Everything goes to the last step and then it fails.2) I cant get a SQL server 2008 backup to restore on SQL SEerver 2005 either.
The only way I know that works is to script the creation of all tables then export and import. This does work.
How can I get the 'entire' database, structure and data, from 2008 to 2005?
ThanksSQL newbie.
View 2 Replies
View Related
Dec 22, 2006
Hi Guys,
I have been trying to search for a free asp or asp.net script that will allow me to upload a .csv file and import it into an MS SQL Database. As its going to be a ProductCatalog and pricing changes nearly 2nd day. And wanting to an a script that I can put in my admin panel on my site to upload a .csv file and import it to a MS SQL Database.
I will be updating fields as well as adding new products. So the upload script would need to be able to handle those two things.
Is their any good free scripts around that people can recommend.
Thanks
Matthew
View 3 Replies
View Related
Jan 3, 2007
hello,
i've to do this:
i've a client that exports data from an msde local db as an xml file based on a select for xml, then i have to insert this xml file into an sql server 2005 db, but not as an xml data type but as they are in the local db:
1) select something from somewhere for xml ok
2) buid the xml file ok
3) insert something into somewhere ????
View 3 Replies
View Related
Dec 3, 2007
Hello,
I am importing a CSV file that is built by someone else. The data has fields like this:
"This is one of the field's data, with some commas, which is throwing the import off"
Can you control in SQL for it to say that whenever commas appear between "", to ignore these as column separators? Right now, each comma within text between "" is considered a separate column, throwing a wrench into things.
Thanks.
View 8 Replies
View Related
Jan 7, 2008
Hi there, wondering if someone could shed some light. I have a text file when i am in sql2000 and import it, it imports fine when io try to import it to sql2005 i get errors. is there something i need to do. It is not going into an already created table the file itself will create a new table so i am unsure why any problems should arise
View 3 Replies
View Related
Dec 7, 2007
Hi All,
I'm trying to import from Oracle Rdb database into SQL server 2005 via ODBC without much success.
I've installed the correct Oracle Rdb driver and verified it all works ok by importing in to Access.
Using the import wizard within SQL mgt studio and the following connection strings I get a password error
Dsn=XRS;Driver={Oracle RDB Driver};sid=system
TITLE: SQL Server Import and Export Wizard
------------------------------
The operation could not be completed.
------------------------------
ADDITIONAL INFORMATION:
ERROR [HY000] [Oracle][ODBC][Rdb]%SQLSRV-F-GETACCINF, Oracle SQL/Services authorization failed
ERROR [HY000] [Oracle][ODBC][Rdb]%SQLSRV-F-GETACCINF, Oracle SQL/Services authorization failed
------------------------------
BUTTONS:
OK
------------------------------
I know the username/password combination to be correct.
Is SSIS the way to go. I've had a quick look at this and setup the ODBC connection but the column
mappings box reports the following...
error at data flow task [datareader source[1]; cannot aquire a managed connection
from the run-time connection manager.
Anyone point me towards any examples of reading in data via ODBC and storing in a SQL server database.
Should point out that the source is not Oracle RDBMS (7,8 or 9) but Oracle Rdb which is a
completely seperate product.
Thanks in advance
Dave
View 10 Replies
View Related
Dec 5, 2007
I have an Older version DB in SQL and would like to import in into the newly installed SQL Server 2005 (which comes with visual Studio 2005)...
Please advise how to do it!.. i can't seem to find a way...
View 1 Replies
View Related
Nov 16, 2007
I need to create an application to import several text, excel and mdb files into SQL2005. I created a c# application to dynamically create a package & import text files but not able to do the same with excel and mdb files.
I guess i am not giving the right connections. Any help on this please........
//Create connections
//Source Connection
IDTSComponentMetaData90 ExcelSource;
IDTSComponentMetaData90 oledbDestination;
MainPipe dataFlow;
//Add connections
ConnectionManager conMgr = pkg2.Connections.Add("OLEDB");
ConnectionManager EconMgr = pkg2.Connections.Add("EXCEL");
/// Set stock properties
conMgr.Name = "OLEDBConnection";
conMgr.ConnectionString = ConnString;//
//Set stock properties
EconMgr.Name = "ExcelConnection";
EconMgr.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + InputfileLoc +
";Extended Properties=Excel 8.0;HDR=YES;";
TaskHost th = pkg2.Executables.Add("DTS.Pipeline") as TaskHost;
th.Name = "DataFlow";
dataFlow = th.InnerObject as MainPipe;
// set source component
ExcelSource = dataFlow.ComponentMetaDataCollection.New();
ExcelSource.ComponentClassID = "DTSAdapter.ExcelSource";
ExcelSource.Name = "ExcelSource";
CManagedComponentWrapper instanceSource = ExcelSource.Instantiate();
ExcelSource.RuntimeConnectionCollection.New();
ExcelSource.RuntimeConnectionCollection[0].ConnectionManagerID = pkg2.Connections["ExcelConnection"].ID;
ExcelSource.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(pkg2.Connections["ExcelConnection"]);
instanceSource.ProvideComponentProperties();
instanceSource.SetComponentProperty("OpenRowset", "book1");
instanceSource.SetComponentProperty("AccessMode", 0);
// Acquire Connections and reinitialize the component
instanceSource.AcquireConnections(null); -----I am failing here with a com exception
instanceSource.ReinitializeMetaData();
instanceSource.ReleaseConnections();
//set destination component
oledbDestination = dataFlow.ComponentMetaDataCollection[1];
if (oledbDestination.RuntimeConnectionCollection.Count > 0)
{
oledbDestination.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(pkg2.Connections["OLEDBConnection"]);
oledbDestination.RuntimeConnectionCollection[0].ConnectionManagerID = pkg2.Connections["OLEDBConnection"].ID;
}
CManagedComponentWrapper instanceDest = oledbDestination.Instantiate();
instanceDest.SetComponentProperty("OpenRowset", desttable);
instanceDest.SetComponentProperty("AccessMode", 0);
// Acquire Connections and reinitialize the component
instanceDest.AcquireConnections(null);
instanceDest.ReinitializeMetaData();
instanceDest.ReleaseConnections();
IDTSInput90 input = oledbDestination.InputCollection[0];
IDTSVirtualInput90 vInput = input.GetVirtualInput();
foreach (IDTSVirtualInputColumn90 vColumn in vInput.VirtualInputColumnCollection)
{
IDTSInputColumn90 vCol = instanceDest.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READWRITE);
instanceDest.MapInputColumn(input.ID, vCol.ID, input.ExternalMetadataColumnCollection[vColumn.Name].ID);
}
//string currentDirectory = System.IO.Directory.GetCurrentDirectory();
a.SaveToXml(Pacloc, pkg2, null);
View 5 Replies
View Related
Mar 5, 2008
I just installed SQL 2005 and am having trouble with the import wizard. After I select import data I get the following error.
I am running SQL on XP. Does anyone have a lead on this error?
===================================
This wizard will close because it encountered the following error: (Microsoft SQL Server)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.UI.WizardFrameworkErrorSR&EvtID=UncaughtException&LinkId=20476
===================================
No description found
------------------------------
Program Location:
at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.get_DBProviderInfos()
at Microsoft.SqlServer.Dts.DtsWizard.DTSWizard.GetDtsDbProviderInfos(WizardInputs wizardInputs)
at Microsoft.SqlServer.Dts.DtsWizard.DataSourceCombo.PopulateProviders(Boolean fSources, WizardInputs wizardInputs)
at Microsoft.SqlServer.Dts.DtsWizard.Step1.OnInitializePage(EventArgs e)
at Microsoft.SqlServer.Management.UI.WizardPage.RaiseEnterPage()
at Microsoft.SqlServer.Management.UI.WizardForm.NextPage(WizardPage nextPage)
at Microsoft.SqlServer.Management.UI.WizardForm.Next_Click(Object sender, EventArgs e)
View 5 Replies
View Related
Apr 2, 2008
I select a database then right click and select import data. The import wizard screen shows then I click Next
and get the following error. The wizard will close because it encountered the following error: Additional Information> No description found.
===================================
This wizard will close because it encountered the following error: (Microsoft SQL Server)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.UI.WizardFrameworkErrorSR&EvtID=UncaughtException&LinkId=20476
===================================
No description found
I am at a loss to fix this error. Is there another way to import data without using the wizard?
Robert
View 4 Replies
View Related
Jan 10, 2006
I have problems importing tables from db2 using the import wizard using IBM OLE DB Provider for DB2
The tables and data ('Preview...') can be viewed but when trying to map the columns ('Edit...' next to the tables) or import the data an error is recieved
[DB2/NT] SQL0443N Routine "SYSIBM.SQLCOLUMNS" (specific name "COLUMNS") has returned an error SQLSTATE with diagnostic text "SYSIBM:CLI:-727". SQLSTATE=38553
Schemas is used in both DB2 and Sql 2005
There is no problem importing to Sql 2000
View 1 Replies
View Related
Dec 20, 2006
I have SSMSexpress which does not include the Tasks/Import Data...Is there an easy way to do this without the full SSMS?I have SQL Server 2005 express for developement which I like alot. Can I possibly load SSMS without installing the entire SQL Server 2005 product?
PS I am almost a complete idiot with SQL Server DBs and I use Visual Basic, not C#
thanksMilton
View 1 Replies
View Related
Dec 28, 2007
i have a comma delimited file, and when i have to use commas inside of the data i use quotes to qualify that. but sql import export is ignoring the quotes and delimiting on every comma. does anyone know how to get around this.... for example in access i can have a comma delimited file and there is a drop down list that says "text qualifier" and i can pick ' or " .... is there anyway to do something like this in sql
View 6 Replies
View Related
May 20, 2008
I can not find "import/export" in SQL Server 2005 "microsoft SQL Server Management Studio Express" How do I move a database from SQL Server 2000 to SQL server 2005?
View 5 Replies
View Related
Sep 8, 2006
I need to export tables/views/stored procs and user functions from one DB to another on a regular schedule. It would be good if I can make a deployable application so that it can be scheduled with sql agent.
I tried to use DTSWizard with Management studio but it does not seem to export stored procedures. Can someone walk me though this ?
Thankyou
View 1 Replies
View Related
Mar 12, 2007
Hi,
I have developed an application in .NET 2005 using sql server 2005.
This is the enhancement to the existing application.Now whats the problem is, one of the customer wants his old database, which is in sql 2000 server with the new database(sql 2005 server). So, how can i import sqlserver 2000 database into sqlserver 2005 database.
Its very urgent plz.........
Regards,
Kishore
View 1 Replies
View Related
Jul 9, 2007
All,
Subject: SQL Server 2005 - How do I import data from an Oracle Data Pump file?
Tried looking in the SQL help for this and it's not very forthcoming on how
you do this.
How do I achieve this? Can someone send me an example SSIS package OR tell
me the steps OR point me towards a resource that could help me?
Look forward to your replies.
Many thanks,
Regards,
Richard.
View 1 Replies
View Related
Sep 6, 2007
hi all,
i didn't found the export import option in sql server 2005. experts, please guide me where can i found this?
Vinod
Even you learn 1%, Learn it with 100% confidence.
View 12 Replies
View Related
Apr 7, 2006
i hava tried installing the "SQL2000SampleDb" but the db is not
on the db list after the install
View 1 Replies
View Related
Aug 9, 2007
Hi,
I know how to import the .rpt file into Access database using import.
can some body tell about how to import to SQL Server 2005 database, both front end (using some utility or interface) and back end (directly accessing the server) solution.
Thanks,
Fahim.
View 8 Replies
View Related
Sep 18, 2006
I'm using SQL Server 2005 Management Studio Express, and trying to import data from an Excel spreadsheet into a new table. I'm used to doing this through Enterprise Manager in SQL Server 2000, but I'm not sure how to do it in the new interface. Is there a way to do a simple data import without also installing Business Intelligence Development Studio?
View 3 Replies
View Related
Mar 19, 2008
I am trying to import data from our as/400 to SQL server. We have a new server with SQL 2005, data is restored so now I am trying to convert our DTS over to SSIS but I can's seem to get a connection set up that will talk with our as/400. One note on our current sql 2000 I have no issues. Our sql 2005 is 64 bit, not sure if it makes a difference but thought I would mention it.
I am trying to set up connections so I can copy data from as/400 to sql 2005. I have a DNS set up on server called IPTSFIL which point to library iptsfil. I then need to create my source. There is no longer an ODBC option so I am trying ole db source. I created a connection but it€™s not working. In the connection there is a data link if I click on that I can point it to my DSN (IPTSFIL). But when I try to test it then thinks server name is IPTSFIL which is not the case and so it comes back with a port error due to that not being the system name. What am i doing wrong?
I read some people use data reader but I don't understand how to config that. Any input on how to help me get this working either using ole db or datareader would be appreciated.
I did test a client access session on server and I connect just fine. Also if I do a cwbping everything comes back sucessful.
Thanks in Advance,
Stacy
View 1 Replies
View Related
Jun 15, 2007
As title, what's the best practise of importing XML data into SQL Server 2005?
I have found this one. http://support.microsoft.com/default.aspx/kb/316005. Is it good enough?
The XML is generated by another system on daily basis. So, the import should be able to handle insert and update cases. How can I do that? Thanks!
View 2 Replies
View Related
Jan 29, 2008
Can anyone help me out with importing data from access2007 to sql 2005???
Thanks! I appreciate it!
View 8 Replies
View Related