Friday, February 24, 2012

import and convert table data

Hi everyone,
I have some data in a CSV file, and I have to import it into a table. For some reason, I am supposed to import this data into a temp table and then move it to the original table and I have to convert it to the right data types while I do this. Is there a better way to do this and how can I give custom error messages saying, for e.g., the data type cannot be converted, the right number of records are not present etc.

Thanks for the help.

I'm guessing the "for some reason" is something like... While your little import routine is busy farting around trying to import some data, that may or may not actually load into the original table, some other processes may actually want to use the original table without it being locked for long periods of time. Some people get a wee bit upset when the company websites go down because some newbie decided it'd be a good idea to try and do bulk imports from external sources because it's easy.

And sounds like you are looking for a DTS package to import from a CSV file into a temp table, then launching a stored procedure to merge changes in after it's complete.

Import Analysis Services 2005 cube into Siebel Analytics

Hi,

I'm trying to import a cube I've created with Analysis Services 2005 into Siebel Analytics Physical Layer.

I've installed XML For Analysis SDK on the SQL Server and created a virtual directory which contains the file msxisapi.dll.

When I try to import I get the following error message fro the server :"Error proccesing request".

I think the problem occurs because the xmla service doesn't "know" I want to import the cube from it.

I'm very new to the issue and we don't have knowledge in our company to solve the problem.

I'll very appreciate it if someone could help me.

Thanks in Advance,

Moving to the SQL Server Analysis Services forum.

import an xml-file to sql2005

Dear all,
I'm trying to import an xml-file by passing the path i.e.
"D:\sql\project\bill_count_1.xml" to an db-procedure as in-param.
As a result whole the file-content should be saved in one column.
using SQL-2005.
The table looks like
create table test
(
id identity
, doc xml
)
You can solve the problem with openxml, openrowset, bulk insert and bcp
if you use the path as a string directly in the code but I could'nt
manage the import by sending the file-path as in-param to a db-proc
Thanks,
Every kind of help appr.
BR
AnwarHello anwar,
There's isn't any magic proc that does this for you. it can use dynamic SQL
inside of your own proc and openrowset to make this happen.
Cheers,
Kent Tegels
http://staff.develop.com/ktegels/

import an xml-file to sql2005

Dear all,
I'm trying to import an xml-file by passing the path i.e.
"D:\sql\project\bill_count_1.xml" to an db-procedure as in-param.
As a result whole the file-content should be saved in one column.
using SQL-2005.
The table looks like
create table test
(
id identity
, doc xml
)
You can solve the problem with openxml, openrowset, bulk insert and bcp
if you use the path as a string directly in the code but I could'nt
manage the import by sending the file-path as in-param to a db-proc
Thanks,
Every kind of help appr.
BR
AnwarHello anwar,
There's isn't any magic proc that does this for you. it can use dynamic SQL
inside of your own proc and openrowset to make this happen.
Cheers,
Kent Tegels
http://staff.develop.com/ktegels/

import an xml-file to sql2005

Dear all,
I'm trying to import an xml-file by passing the path i.e.
"D:\sql\project\bill_count_1.xml" to an db-procedure as in-param.
As a result whole the file-content should be saved in one column.
using SQL-2005.
The table looks like
create table test
(
id identity
, doc xml
)
You can solve the problem with openxml, openrowset, bulk insert and bcp
if you use the path as a string directly in the code but I could'nt
manage the import by sending the file-path as in-param to a db-proc
Thanks,
Every kind of help appr.
BR
Anwar
Hello anwar,
There's isn't any magic proc that does this for you. it can use dynamic SQL
inside of your own proc and openrowset to make this happen.
Cheers,
Kent Tegels
http://staff.develop.com/ktegels/

import an excel file

I tried to import an excel file using import/export wizard. When I launch
it, it gives me an error:
The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
and registered. The wizard cannot continue and will terminate.
Additional Information:
Unable to cast COM object of type ...
Can anyone please tell me how to fix this? Thanks.
Hi
You should find dts.dll in C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll
Run this with the /u flag will unload the dll if necessary.
If you are not using SP1 you may want to load this to see if the problem is
resolved. If this does not cure the issue please post error numbers and the
full error message and any information from the event log as well.
HTH
John
"00KobeBrian" wrote:

> I tried to import an excel file using import/export wizard. When I launch
> it, it gives me an error:
> The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
> and registered. The wizard cannot continue and will terminate.
> Additional Information:
> Unable to cast COM object of type ...
>
> Can anyone please tell me how to fix this? Thanks.
>
>
|||Just want to clarify.
So do you want me to run regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll /u
Then run regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
and see if it works?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
|||I got it now. Thanks.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
|||Hi
Does this mean it is working?
Running regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
whilst it is registered would not cause any problems, but it is a good idea
to try and unregister it first.
John
"00KobeBrian" wrote:

> I got it now. Thanks.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
>
>

import an excel file

I tried to import an excel file using import/export wizard. When I launch
it, it gives me an error:
The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
and registered. The wizard cannot continue and will terminate.
Additional Information:
Unable to cast COM object of type ...
Can anyone please tell me how to fix this? Thanks.Hi
You should find dts.dll in C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll
Run this with the /u flag will unload the dll if necessary.
If you are not using SP1 you may want to load this to see if the problem is
resolved. If this does not cure the issue please post error numbers and the
full error message and any information from the event log as well.
HTH
John
"00KobeBrian" wrote:

> I tried to import an excel file using import/export wizard. When I launch
> it, it gives me an error:
> The SSIS Runtime object could not be created. Verify that DTS.dll is avaib
le
> and registered. The wizard cannot continue and will terminate.
> Additional Information:
> Unable to cast COM object of type ...
>
> Can anyone please tell me how to fix this? Thanks.
>
>|||Just want to clarify.
So do you want me to run regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll /u
Then run regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
and see if it works?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>|||I got it now. Thanks.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>|||Hi
Does this mean it is working?
Running regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
whilst it is registered would not cause any problems, but it is a good idea
to try and unregister it first.
John
"00KobeBrian" wrote:

> I got it now. Thanks.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
>
>

import an excel file

I tried to import an excel file using import/export wizard. When I launch
it, it gives me an error:
The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
and registered. The wizard cannot continue and will terminate.
Additional Information:
Unable to cast COM object of type ...
Can anyone please tell me how to fix this? Thanks.Hi
You should find dts.dll in C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll
Run this with the /u flag will unload the dll if necessary.
If you are not using SP1 you may want to load this to see if the problem is
resolved. If this does not cure the issue please post error numbers and the
full error message and any information from the event log as well.
HTH
John
"00KobeBrian" wrote:
> I tried to import an excel file using import/export wizard. When I launch
> it, it gives me an error:
> The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
> and registered. The wizard cannot continue and will terminate.
> Additional Information:
> Unable to cast COM object of type ...
>
> Can anyone please tell me how to fix this? Thanks.
>
>|||Just want to clarify.
So do you want me to run regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll /u
Then run regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
and see if it works?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>> I tried to import an excel file using import/export wizard. When I launch
>> it, it gives me an error:
>> The SSIS Runtime object could not be created. Verify that DTS.dll is
>> avaible
>> and registered. The wizard cannot continue and will terminate.
>> Additional Information:
>> Unable to cast COM object of type ...
>>
>> Can anyone please tell me how to fix this? Thanks.
>>|||I got it now. Thanks.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>> I tried to import an excel file using import/export wizard. When I launch
>> it, it gives me an error:
>> The SSIS Runtime object could not be created. Verify that DTS.dll is
>> avaible
>> and registered. The wizard cannot continue and will terminate.
>> Additional Information:
>> Unable to cast COM object of type ...
>>
>> Can anyone please tell me how to fix this? Thanks.
>>|||Hi
Does this mean it is working?
Running regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
whilst it is registered would not cause any problems, but it is a good idea
to try and unregister it first.
John
"00KobeBrian" wrote:
> I got it now. Thanks.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
> > Hi
> >
> > You should find dts.dll in C:\Program Files\Microsoft SQL
> > Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> > this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> > Server\90\DTS\Binn\DTS.dll
> >
> > Run this with the /u flag will unload the dll if necessary.
> >
> > If you are not using SP1 you may want to load this to see if the problem
> > is
> > resolved. If this does not cure the issue please post error numbers and
> > the
> > full error message and any information from the event log as well.
> >
> > HTH
> >
> > John
> >
> > "00KobeBrian" wrote:
> >
> >> I tried to import an excel file using import/export wizard. When I launch
> >> it, it gives me an error:
> >>
> >> The SSIS Runtime object could not be created. Verify that DTS.dll is
> >> avaible
> >> and registered. The wizard cannot continue and will terminate.
> >>
> >> Additional Information:
> >> Unable to cast COM object of type ...
> >>
> >>
> >> Can anyone please tell me how to fix this? Thanks.
> >>
> >>
> >>
>
>

Import an Access Database

I am trying to import an Access database and I am using SQL Server Express. The instructions say to

In SQL Server Management Studio, connect to the Database Engine server type, expand Databases, right-click a database, point to Tasks, and then click Import Data or Export data.

When I point to Tasks, the Import Data is not listed.

If someone can help. Should I be able to use the Import Wizard?

Thanks,

Dougins

Import/Export is not available on SqlExpress.

Integration and Interoperability Feature Express Workgroup Standard Enterprise Comments

Import/Export

|||http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx|||did this answer your question?

Import an Access Database

I am trying to import an Access database and I am using SQL Server Express. The instructions say to

In SQL Server Management Studio, connect to the Database Engine server type, expand Databases, right-click a database, point to Tasks, and then click Import Data or Export data.

When I point to Tasks, the Import Data is not listed.

If someone can help. Should I be able to use the Import Wizard?

Thanks,

Dougins

Import/Export is not available on SqlExpress.

Integration and Interoperability

Feature

Express

Workgroup

Standard

Enterprise

Comments

Import/Export

|||http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx|||did this answer your question?

Import all xml-Files from a Folder into SQL

Hello

I'm just starting with SQL and BIDS. I have created a xml-Import to SQL Server which works without any problem.

Now I like to import (daily) all xml-files of an appropriate Folder at once to the DB. The files will have different names each day.

I could not find any help in the internet to solve this problem.

Can someone give me an Idea how to import many xml-files out of the same folder to SQL?

Thanks & regards

Chaepp

The For Each Loop can do this. It is covered in Books online, or try this article-

Looping over files with the Foreach Loop
(http://www.sqlis.com/default.aspx?55)

|||

Hi DarrenSQLIS

Thank You very much for the info's. It's working perfect.....

Have a nice day

Regards

Chaepp

import accessfiles with stored procedures

Hi,
Could somebody tell me how to import access-files to a sql server database?
I would like to import all tables from access to the temp, do some
data-manipulation and then insert into a database. I know that dts can
import, but i want to address the tempdb so i don't have to create
temptables in my databases.
I hope someone can help me.Jason
One option is
INSERT INTO .....
SELECT *
FROM OPENDATASOURCE(
'Microsoft.Jet.OLEDB.4.0',
'Data Source="d:\northwind.mdb";
User ID=Admin;Password='
)...Customers
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:esocaw2EFHA.3416@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Could somebody tell me how to import access-files to a sql server
database?
> I would like to import all tables from access to the temp, do some
> data-manipulation and then insert into a database. I know that dts can
> import, but i want to address the tempdb so i don't have to create
> temptables in my databases.
> I hope someone can help me.
>|||Hi Uri,
I've tried to use your example, but i'm getting errors which says that it
cannot find the path, but i'm sure the file is there?
Here's the statement:
SELECT *
FROM OPENDATASOURCE( 'Microsoft.Jet.OLEDB.4.0','Data
Source="D:\klient.mdb";User ID=Admin;Password=')...sysdata
And here's the error:
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.
[OLE/DB provider returned message: Could not find file 'D:\klient.mdb'.]
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
IDBInitialize::Initialize returned 0x80004005: ].
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:etAE$62EFHA.2568@.TK2MSFTNGP10.phx.gbl...
> Jason
> One option is
> INSERT INTO .....
> SELECT *
> FROM OPENDATASOURCE(
> 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="d:\northwind.mdb";
> User ID=Admin;Password='
> )...Customers
>
> "Jason" <jasonlewis@.hotrmail.com> wrote in message
> news:esocaw2EFHA.3416@.TK2MSFTNGP09.phx.gbl...
> database?
>|||Jason
Have you ran on the server or client machine?
Where is the file's location on the server?
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:OY5T7zAFFHA.1564@.TK2MSFTNGP09.phx.gbl...
> Hi Uri,
> I've tried to use your example, but i'm getting errors which says that it
> cannot find the path, but i'm sure the file is there?
> Here's the statement:
> SELECT *
> FROM OPENDATASOURCE( 'Microsoft.Jet.OLEDB.4.0','Data
> Source="D:\klient.mdb";User ID=Admin;Password=')...sysdata
> And here's the error:
> Server: Msg 7399, Level 16, State 1, Line 1
> OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.
> [OLE/DB provider returned message: Could not find file 'D:\klient.mdb'.]
> OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
> IDBInitialize::Initialize returned 0x80004005: ].
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:etAE$62EFHA.2568@.TK2MSFTNGP10.phx.gbl...
>|||Hi Uri,
The files resides on a client pc.
Greetings,
J
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eU3lf$AFFHA.2156@.TK2MSFTNGP10.phx.gbl...
> Jason
> Have you ran on the server or client machine?
> Where is the file's location on the server?
>
> "Jason" <jasonlewis@.hotrmail.com> wrote in message
> news:OY5T7zAFFHA.1564@.TK2MSFTNGP09.phx.gbl...
it
can
>|||Then you need to specify an UNC path for the file, and the share need to acc
essible to SQL Server
and the account that SQL Server is using need to have permissions on the sha
re.
SQL Server is a *server* product, the queries are executed on the server, no
t the client. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jason" <jasonlewis@.hotrmail.com> wrote in message news:Oub81JCFFHA.3940@.tk2msftngp13.phx.g
bl...
> Hi Uri,
> The files resides on a client pc.
> Greetings,
> J
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:eU3lf$AFFHA.2156@.TK2MSFTNGP10.phx.gbl...
> it
> can
>

Import Access tables into SQL

Still really new at all this, but learning lots thanks to this forum.

I was wondering - is there a way to import Access tables into my SQL Server 2005 ?

(The Data and the Table Design?)

Go to Microsoft SQL Server Management studio. select your database or create a new database. in database explorer right click on database , select all tasks , and there select import data there you will be asked source database select access file. and get import it

krishna

|||

Thanks for your reply.

I right click, but I don't get an import option.

What am I doing wrong ?

I've got Shrink, Detach, Backup, Restore, and Generate scripts.

|||

Please don't tell me this is yet another "should be super simple - but the Microsoft tools can't do it" type functions.

I kick myself everyday for not starting these projects in PHP / MySQL.

As someone in this forum has said on a few occasions..... 'ASP.NET......... it makes the Hard stuff easy, but makes the easy stuff hard'.

Import Access table to SQL Server

I have an Access 2002 database that I am importing into SQL Server. I have t
rouble with one field type. It a short time in Accws, defined date time and
displayed as hh.mm AM. I can't import this field (I get an overflow message)
. Any ideas.
thans,
StanYou can't directly import it into a smalldatetime or
datetime field as SQL Server doesn't support just a time
field. I can't remember all the details but if you try to
import the column, it uses a date that is out of the range
for SQL Server's destination column. I can't remember the
date Access tries to use but you could try changing the
destination to datetime if it's set to smalldatetime. Or you
may need to use a varchar or some logic for a date
calculation using something like DTS.
-Sue
On Mon, 19 Jul 2004 13:22:02 -0700, "Stanley"
<Stanley@.discussions.microsoft.com> wrote:

>I have an Access 2002 database that I am importing into SQL Server. I have
trouble with one field type. It a short time in Accws, defined date time and
displayed as hh.mm AM. I can't import this field (I get an overflow message
). Any ideas.
>thans,
>Stan

Import Access table to SQL Server

I have an Access 2002 database that I am importing into SQL Server. I have trouble with one field type. It a short time in Accws, defined date time and displayed as hh.mm AM. I can't import this field (I get an overflow message). Any ideas.
thans,
Stan
You can't directly import it into a smalldatetime or
datetime field as SQL Server doesn't support just a time
field. I can't remember all the details but if you try to
import the column, it uses a date that is out of the range
for SQL Server's destination column. I can't remember the
date Access tries to use but you could try changing the
destination to datetime if it's set to smalldatetime. Or you
may need to use a varchar or some logic for a date
calculation using something like DTS.
-Sue
On Mon, 19 Jul 2004 13:22:02 -0700, "Stanley"
<Stanley@.discussions.microsoft.com> wrote:

>I have an Access 2002 database that I am importing into SQL Server. I have trouble with one field type. It a short time in Accws, defined date time and displayed as hh.mm AM. I can't import this field (I get an overflow message). Any ideas.
>thans,
>Stan

Import Access Reports

I had been successfully importing Access reports into SQL Reporting Services.
Now all of sudden when I go to the Project menu to select the Import option,
it's no longer there. I can't find it anywhere now. The only thing that I've
done since I was able to import is, load XPsp2. Am I missing something? Any
suggestions?Please see the following KB article:
Some programs seem to stop working after you install Windows XP Service Pack
2
http://support.microsoft.com/default.aspx?kbid=842242
You may have encountered this situation.
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Huey" <Huey@.discussions.microsoft.com> wrote in message
news:A712782F-CC81-453C-92A3-E4FA99FEC197@.microsoft.com...
> I had been successfully importing Access reports into SQL Reporting
Services.
> Now all of sudden when I go to the Project menu to select the Import
option,
> it's no longer there. I can't find it anywhere now. The only thing that
I've
> done since I was able to import is, load XPsp2. Am I missing something?
Any
> suggestions?

Import Access Report

I need to import Access Reports to Reporting Service on fly using VB.NET code. How can I do that? I know how to do that using Report designer but it is not going to work because we have to convert 500 Crying [:'(]reports. Any help will be highly appreciated.

I'm in the same boat. I have tried various report-to-xml export options but I get nothing but errors trying to get a functioning xml report working in Visual web developer. Sure hope someone can chime in on this subject. Zero help from Microsoft.

Import access report

Hello,
I want to import access report into sql reporting, but i dont have the
option in the project menu "Import Reports "-->"Microsoft Access...".
I'm working on windows 2000 and i have installed Sql reporting server SP1.
Any Idea ?
Thank you for your help !James,
It's not in the Report menu, it's in the solution explorer.
In your report project, rightclick Reports folder and choose Import
Reports..
Jon Jahren
"James" <James@.discussions.microsoft.com> wrote in message
news:8E3F7A8A-4940-4B91-8337-D537CFF928FF@.microsoft.com...
> Hello,
> I want to import access report into sql reporting, but i dont have the
> option in the project menu "Import Reports "-->"Microsoft Access...".
> I'm working on windows 2000 and i have installed Sql reporting server SP1.
> Any Idea ?
> Thank you for your help !
>|||Thank you for your answer Jon, but the problem was that i had Access 2000 and
the option to import Access Report is available only with at least access
2002 !!!
I did an update and now it's working fine.

Import Access File

Is there a way to import an access table into Microsoft SQL Server Express with Server Management Studio? I prefer not to use the upsize tool from access. Another option would be to import from a text file, if someone can explain how to do this.

Thanks

hi,

nope, this is not "available"... but you could use a linked server approach..

regards|||

Microsoft has an excellent tool for migrating Access tables: SQL Migration Assistant for Access. Try:

www.microsoft.com/sql/solutions/migration/access/default.mspx

If you just search the Microsoft site for SQL Migration Assistant for Access it will give you several links to follow.

Hope that helps.

Don Seydel

Import Access DB into SQL with OSQL?

Hello all.

I was wondering if there is a way to import an Access database into an MS SQL (MSDE) database using OSQL? I need to write an updater to send out to some customers, that will accomplish this. The Access database and its corresponding SQL database have the same table structure, i just need to update the data. I would like to use OSQL so I can make this process automated, behind the scenes of my GUI updater, for the customer.

I would love to be able to do something like this:

osql -E -Q"IMPORT DATABASE blabla FROM DISK = 'C:\blabla.mdb' WITH REPLACE"

Any ideas? Thanks so much all for looking.

JnuwNo one has a way for me to import an access database through a script or using osql? Help please, thank you all for looking.

Import Access Database?

I am trying to upsize an Access database with the intent of using Access as
the front-end and MSDE as the back-end. I know MSDE allows you to import
DTS
packages, but I am not really familiar with DTS, so I decided to use the
Access wizard.
All in all, it seems pretty straight forward. I chose a default instance of
SQL Server that I created using the MSDE (residing on my local machine), set
a username and password, and told it to link the tables (I also tried using
..adp, but I got the same errors). I also told it to upsize the indexes, but
nothing else.
The program seemed to be working fine, but when it finished it gave me the
following error messages:
EXEC sp_addextendedproperty N'Attributes', N'2', N'user', N'dbo', N'table',
N'EntireSpreadsheet', N'column', N'ID'
EXEC sp_addextendedproperty N'CollatingOrder', N'1033', N'user', N'dbo',
N'table', N'EntireSpreadsheet', N'column', N'ID'
EXEC sp_addextendedproperty N'Type', N'10', N'user', N'dbo', N'table',
N'EntireSpreadsheet', N'column', N'ID'
...
and also:
Server Error 15233: Property cannot be added. Property 'Attributes' already
exists for 'dbo.EntireSpreadsheet.ID'.
I am not entirely sure what these errors mean, and all the data seems to be
displaying properly, but if anyone could offer any suggestions about how to
import the file to MSDE (even if it's using DTS) I would appreciate it.
Thanks,
Chris
Here's a resource that has links to various topics that address your
questions:
Migrating Microsoft Access Applications to SQL Server
http://www.microsoft.com/sql/accessmigration.mspx.
--Mary
On Mon, 10 Oct 2005 17:02:16 -0400, "Chris Burnette"
<chrisb@.publishamerica.com> wrote:

>
>I am trying to upsize an Access database with the intent of using Access as
>the front-end and MSDE as the back-end. I know MSDE allows you to import
>DTS
>packages, but I am not really familiar with DTS, so I decided to use the
>Access wizard.
>All in all, it seems pretty straight forward. I chose a default instance of
>SQL Server that I created using the MSDE (residing on my local machine), set
>a username and password, and told it to link the tables (I also tried using
>.adp, but I got the same errors). I also told it to upsize the indexes, but
>nothing else.
>The program seemed to be working fine, but when it finished it gave me the
>following error messages:
>EXEC sp_addextendedproperty N'Attributes', N'2', N'user', N'dbo', N'table',
>N'EntireSpreadsheet', N'column', N'ID'
>EXEC sp_addextendedproperty N'CollatingOrder', N'1033', N'user', N'dbo',
>N'table', N'EntireSpreadsheet', N'column', N'ID'
>EXEC sp_addextendedproperty N'Type', N'10', N'user', N'dbo', N'table',
>N'EntireSpreadsheet', N'column', N'ID'
>...
>and also:
>Server Error 15233: Property cannot be added. Property 'Attributes' already
>exists for 'dbo.EntireSpreadsheet.ID'.
>I am not entirely sure what these errors mean, and all the data seems to be
>displaying properly, but if anyone could offer any suggestions about how to
>import the file to MSDE (even if it's using DTS) I would appreciate it.
>Thanks,
>Chris
>

Import Access data to SQL

I was using DTS to import some Access data to SQL Server 2000 and came
across some queries in Access that I thought would be converted into views .
There were around 50 queries in Access and just 3 of them showed up in the
DTS Wizard and that too they turned out to be tables on SQL Server. I was
hoping that maybe these select queries may turn into view or built as stored
procedure.
Is that not the case ? If so, do I have to manually create them.
Thanks
Most likely, (IMO, it is preferred), you need to manually recreate those
queries in Access as most suitable SQL Server object, views, SPs or UDFs,
not only due to the differences of the SQL syntex, but also due to the
different functionalities Access and SQL Server provide.
"Hassan" <hassan@.hotmail.com> wrote in message
news:uu2xhi8yHHA.1212@.TK2MSFTNGP05.phx.gbl...
>I was using DTS to import some Access data to SQL Server 2000 and came
>across some queries in Access that I thought would be converted into views
>.
> There were around 50 queries in Access and just 3 of them showed up in the
> DTS Wizard and that too they turned out to be tables on SQL Server. I was
> hoping that maybe these select queries may turn into view or built as
> stored procedure.
> Is that not the case ? If so, do I have to manually create them.
> Thanks
>

Import Access data to SQL

I was using DTS to import some Access data to SQL Server 2000 and came
across some queries in Access that I thought would be converted into views .
There were around 50 queries in Access and just 3 of them showed up in the
DTS Wizard and that too they turned out to be tables on SQL Server. I was
hoping that maybe these select queries may turn into view or built as stored
procedure.
Is that not the case ? If so, do I have to manually create them.
ThanksMost likely, (IMO, it is preferred), you need to manually recreate those
queries in Access as most suitable SQL Server object, views, SPs or UDFs,
not only due to the differences of the SQL syntex, but also due to the
different functionalities Access and SQL Server provide.
"Hassan" <hassan@.hotmail.com> wrote in message
news:uu2xhi8yHHA.1212@.TK2MSFTNGP05.phx.gbl...
>I was using DTS to import some Access data to SQL Server 2000 and came
>across some queries in Access that I thought would be converted into views
>.
> There were around 50 queries in Access and just 3 of them showed up in the
> DTS Wizard and that too they turned out to be tables on SQL Server. I was
> hoping that maybe these select queries may turn into view or built as
> stored procedure.
> Is that not the case ? If so, do I have to manually create them.
> Thanks
>

Import Access data to SQL

I was using DTS to import some Access data to SQL Server 2000 and came
across some queries in Access that I thought would be converted into views .
There were around 50 queries in Access and just 3 of them showed up in the
DTS Wizard and that too they turned out to be tables on SQL Server. I was
hoping that maybe these select queries may turn into view or built as stored
procedure.
Is that not the case ? If so, do I have to manually create them.
ThanksMost likely, (IMO, it is preferred), you need to manually recreate those
queries in Access as most suitable SQL Server object, views, SPs or UDFs,
not only due to the differences of the SQL syntex, but also due to the
different functionalities Access and SQL Server provide.
"Hassan" <hassan@.hotmail.com> wrote in message
news:uu2xhi8yHHA.1212@.TK2MSFTNGP05.phx.gbl...
>I was using DTS to import some Access data to SQL Server 2000 and came
>across some queries in Access that I thought would be converted into views
>.
> There were around 50 queries in Access and just 3 of them showed up in the
> DTS Wizard and that too they turned out to be tables on SQL Server. I was
> hoping that maybe these select queries may turn into view or built as
> stored procedure.
> Is that not the case ? If so, do I have to manually create them.
> Thanks
>

Import a XML file..?

Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.
Do you want the XML to be imported relationally? That is, into separate
tables?
Or do you just want to store the xml as text
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
> Hi all,
> I'm new to XML.
> How can I import a XML-file to a SQL-table?
> /Kent J.
>
>
|||Jeff,
The XML-file consists of data about our customers - Customernumber,Address,
PhoneNumber and so on.
I would like the data to be stored in a single SQL-table.
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> Do you want the XML to be imported relationally? That is, into separate
> tables?
> Or do you just want to store the xml as text
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:FStgd.7428$d5.62954@.newsb.telia.net...
>
|||Look in Books Online under Writing XML using OPENXML
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:pDugd.7430$d5.63053@.newsb.telia.net...
> Jeff,
> The XML-file consists of data about our customers -
Customernumber,Address,
> PhoneNumber and so on.
> I would like the data to be stored in a single SQL-table.
> /Kent J.
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
>
|||Check out:
http://msdn.microsoft.com/library/de...ml/sql01c5.asp
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.
|||OK! I have read 'Writing XML Using OPENXML'
I understand that I first have to prepare the document with:
sp_xml_preparedocument
and then run....
OPENXML
But I'm not closer to solve the problem.
Can you describe how to import a XML-file into a SQL-table in a step-by-step
instruction?
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...[vbcol=seagreen]
> Look in Books Online under Writing XML using OPENXML
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:pDugd.7430$d5.63053@.newsb.telia.net...
> Customernumber,Address,
separate
>
|||The docs have working examples..did you get one of those working? They are
very similar to your requirements.
You are familar with INSERT vs SELECT, correct?
Sorry, but I won't write the code for you. If you have a specific question,
I would be happy to assist.
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>
|||You might want to venture to http://sqlxml.org for great info.
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>

Import a XML file..?

Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.Do you want the XML to be imported relationally? That is, into separate
tables?
Or do you just want to store the xml as text
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
> Hi all,
> I'm new to XML.
> How can I import a XML-file to a SQL-table?
> /Kent J.
>
>|||Jeff,
The XML-file consists of data about our customers - Customernumber,Address,
PhoneNumber and so on.
I would like the data to be stored in a single SQL-table.
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> Do you want the XML to be imported relationally? That is, into separate
> tables?
> Or do you just want to store the xml as text
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:FStgd.7428$d5.62954@.newsb.telia.net...
>|||Look in Books Online under Writing XML using OPENXML
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:pDugd.7430$d5.63053@.newsb.telia.net...
> Jeff,
> The XML-file consists of data about our customers -
Customernumber,Address,
> PhoneNumber and so on.
> I would like the data to be stored in a single SQL-table.
> /Kent J.
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
>|||Check out:
http://msdn.microsoft.com/library/d... />
ql01c5.asp
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.|||OK! I have read 'Writing XML Using OPENXML'
I understand that I first have to prepare the document with:
sp_xml_preparedocument
and then run....
OPENXML
But I'm not closer to solve the problem.
Can you describe how to import a XML-file into a SQL-table in a step-by-step
instruction?
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> Look in Books Online under Writing XML using OPENXML
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:pDugd.7430$d5.63053@.newsb.telia.net...
> Customernumber,Address,
separate[vbcol=seagreen]
>|||The docs have working examples..did you get one of those working' They are
very similar to your requirements.
You are familar with INSERT vs SELECT, correct?
Sorry, but I won't write the code for you. If you have a specific question,
I would be happy to assist.
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>|||You might want to venture to http://sqlxml.org for great info.
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> separate
>

Import a XML file..?

Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.Do you want the XML to be imported relationally? That is, into separate
tables?
Or do you just want to store the xml as text
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
> Hi all,
> I'm new to XML.
> How can I import a XML-file to a SQL-table?
> /Kent J.
>
>|||Jeff,
The XML-file consists of data about our customers - Customernumber,Address,
PhoneNumber and so on.
I would like the data to be stored in a single SQL-table.
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> Do you want the XML to be imported relationally? That is, into separate
> tables?
> Or do you just want to store the xml as text
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:FStgd.7428$d5.62954@.newsb.telia.net...
> > Hi all,
> >
> > I'm new to XML.
> > How can I import a XML-file to a SQL-table?
> >
> > /Kent J.
> >
> >
> >
>|||Look in Books Online under Writing XML using OPENXML
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:pDugd.7430$d5.63053@.newsb.telia.net...
> Jeff,
> The XML-file consists of data about our customers -
Customernumber,Address,
> PhoneNumber and so on.
> I would like the data to be stored in a single SQL-table.
> /Kent J.
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > Do you want the XML to be imported relationally? That is, into separate
> > tables?
> >
> > Or do you just want to store the xml as text
> >
> > Jeff
> >
> > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > Hi all,
> > >
> > > I'm new to XML.
> > > How can I import a XML-file to a SQL-table?
> > >
> > > /Kent J.
> > >
> > >
> > >
> >
> >
>|||Check out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro01/html/sql01c5.asp
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:FStgd.7428$d5.62954@.newsb.telia.net...
Hi all,
I'm new to XML.
How can I import a XML-file to a SQL-table?
/Kent J.|||OK! I have read 'Writing XML Using OPENXML'
I understand that I first have to prepare the document with:
sp_xml_preparedocument
and then run....
OPENXML
But I'm not closer to solve the problem.
Can you describe how to import a XML-file into a SQL-table in a step-by-step
instruction?
/Kent J.
"Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> Look in Books Online under Writing XML using OPENXML
> Jeff
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:pDugd.7430$d5.63053@.newsb.telia.net...
> > Jeff,
> >
> > The XML-file consists of data about our customers -
> Customernumber,Address,
> > PhoneNumber and so on.
> > I would like the data to be stored in a single SQL-table.
> >
> > /Kent J.
> >
> >
> >
> > "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> > news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > > Do you want the XML to be imported relationally? That is, into
separate
> > > tables?
> > >
> > > Or do you just want to store the xml as text
> > >
> > > Jeff
> > >
> > > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > > Hi all,
> > > >
> > > > I'm new to XML.
> > > > How can I import a XML-file to a SQL-table?
> > > >
> > > > /Kent J.
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||The docs have working examples..did you get one of those working' They are
very similar to your requirements.
You are familar with INSERT vs SELECT, correct?
Sorry, but I won't write the code for you. If you have a specific question,
I would be happy to assist.
Jeff
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> > Look in Books Online under Writing XML using OPENXML
> >
> > Jeff
> >
> > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > news:pDugd.7430$d5.63053@.newsb.telia.net...
> > > Jeff,
> > >
> > > The XML-file consists of data about our customers -
> > Customernumber,Address,
> > > PhoneNumber and so on.
> > > I would like the data to be stored in a single SQL-table.
> > >
> > > /Kent J.
> > >
> > >
> > >
> > > "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> > > news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > > > Do you want the XML to be imported relationally? That is, into
> separate
> > > > tables?
> > > >
> > > > Or do you just want to store the xml as text
> > > >
> > > > Jeff
> > > >
> > > > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > > > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > > > Hi all,
> > > > >
> > > > > I'm new to XML.
> > > > > How can I import a XML-file to a SQL-table?
> > > > >
> > > > > /Kent J.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||You might want to venture to http://sqlxml.org for great info.
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nbvgd.7438$d5.62925@.newsb.telia.net...
> OK! I have read 'Writing XML Using OPENXML'
> I understand that I first have to prepare the document with:
> sp_xml_preparedocument
> and then run....
> OPENXML
> But I'm not closer to solve the problem.
> Can you describe how to import a XML-file into a SQL-table in a
step-by-step
> instruction?
> /Kent J.
>
>
>
>
> "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> news:#QXQgodvEHA.2116@.TK2MSFTNGP14.phx.gbl...
> > Look in Books Online under Writing XML using OPENXML
> >
> > Jeff
> >
> > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > news:pDugd.7430$d5.63053@.newsb.telia.net...
> > > Jeff,
> > >
> > > The XML-file consists of data about our customers -
> > Customernumber,Address,
> > > PhoneNumber and so on.
> > > I would like the data to be stored in a single SQL-table.
> > >
> > > /Kent J.
> > >
> > >
> > >
> > > "Jeff Dillon" <jeff@.removeemergencyreporting.com> wrote in message
> > > news:#s#eqbdvEHA.1988@.TK2MSFTNGP12.phx.gbl...
> > > > Do you want the XML to be imported relationally? That is, into
> separate
> > > > tables?
> > > >
> > > > Or do you just want to store the xml as text
> > > >
> > > > Jeff
> > > >
> > > > "Kent Johnson" <08.6044303@.telia.com> wrote in message
> > > > news:FStgd.7428$d5.62954@.newsb.telia.net...
> > > > > Hi all,
> > > > >
> > > > > I'm new to XML.
> > > > > How can I import a XML-file to a SQL-table?
> > > > >
> > > > > /Kent J.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>

import a text file without commas to an sql table

how i can import a text file without commas to an sql table, knowing the
subject of every clomn in the text file (col 1 to col 8- name, col 9 to col
15 - address e.c.)?If you are using DTS, you have to specify the file type as 'fixed width',
and then DTS lets you specify the position of each column. When using BULK
INSERT, you'll have to create a format file that describes the columns.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Sam" <focus10@.zahav.net.il> wrote in message
news:%23vvM3nejFHA.1372@.TK2MSFTNGP10.phx.gbl...
how i can import a text file without commas to an sql table, knowing the
subject of every clomn in the text file (col 1 to col 8- name, col 9 to col
15 - address e.c.)?|||Are you using some other delimiter instead of commas? BCP and DTS let
you configure the delimiter character.
If it's non-delimited then I assume each column is a fixed width. The
text file source driver supports fixed width columns too. In the DTS
designer select the connection properties dialog to configure the
column positions.
David Portas
SQL Server MVP
--|||Why not use the files through a linked server to text files?
More info here:
http://msdn.microsoft.com/library/d...r />
_6a44.asp
And of course *you* have the power to describe, rather to transform your
text files:
http://msdn.microsoft.com/library/d...ma_ini_file.asp
After establishing links to your text files, you can query them with T-SQL
as you would any other SQL table.
ML

import a text file into the database

hello,
i want to import a textfile in the database (SQL)
For access.database the code like:
cnn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\DB1.mdb;" & _
"Jet OLEDB:Engine Type=4;"
sqlString = "SELECT * INTO [tblSample2] FROM
[Text;HDR=NO;DATABASE=e:\My Documents\TextFiles].[Sample2.txt]"
cnn.Execute sqlString
works ok
How can i use such a command for the sql server
sqlString = "SELECT * INTO [tblSample2] FROM
[Text;HDR=NO;DATABASE=e:\My Documents\TextFiles].[Sample2.txt]"
i get the error
"Invalid object name 'Text;HDR=NO;DATABASE=e:\My
Documents\TextFiles\Sample2.txt'."
best regardsYou can use a passthrough query like:
INSERT tbl
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="e:\My Documents\TextFiles].[Sample2.txt]";
User ID=Admin;Password=;Extended properties=text )
Another option is to use xp_cmdshell directly like:
INSERT tbl
EXEC master..xp_cmdshell 'TYPE e:\My Documents\TextFiles].[Sample2.txt]" ;
For complex ascii files you should consider using BULK INSERT/BCP IN or
DTS( Data transformation Services ). See SQL Server Books Online for details
on these utilities.
Anith|||hello Anith,
i tryed to run in the query analyser the command
SELECT * FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data
Source="e:\transfer\Input\t1.txt";Extended properties=text')
but i get the syntax error
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ')'.
any idea?
thanks
Xavier
"Anith Sen" wrote:

> You can use a passthrough query like:
> INSERT tbl
> SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="e:\My Documents\TextFiles].[Sample2.txt]";
> User ID=Admin;Password=;Extended properties=text )
> Another option is to use xp_cmdshell directly like:
> INSERT tbl
> EXEC master..xp_cmdshell 'TYPE e:\My Documents\TextFiles].[Sample2.txt]" ;
> For complex ascii files you should consider using BULK INSERT/BCP IN or
> DTS( Data transformation Services ). See SQL Server Books Online for detai
ls
> on these utilities.
> --
> Anith
>
>

Import a text file into a SQL Server Express (C# code)

I'm trying to read a text and load the data from the text file and import the data into the database.

please help!!

Bulk import text files using .net 2.0 SqlBulkCopy class in C#

|||

Thanxkaushalparik27 for helping out.

import a large table

Hi,
I am importing a large table to a table. The table contains
27 millions rows with 1 or 2 index.
I used Enterprise Manager to do the table import. I see
the "status: 275" on the import screen after 27 millions
rows are inserted. The "status: 275" is on the screen
for 4 hours already. I used "simple" option for the
recovery.
Does import should take more than 10 hours for a 27
millons rows ?
Is there a way which I can use to make import faster,
e.g. command line import option ?
Thanks in advance.
MingTry using bcp to export the data to a file and import from
the file. Use the native format (/N).
Also set batch size.
Create the indexes after the import.
>--Original Message--
>Hi,
>I am importing a large table to a table. The table
contains
>27 millions rows with 1 or 2 index.
>I used Enterprise Manager to do the table import. I see
>the "status: 275" on the import screen after 27 millions
>rows are inserted. The "status: 275" is on the screen
>for 4 hours already. I used "simple" option for the
>recovery.
>Does import should take more than 10 hours for a 27
>millons rows ?
>Is there a way which I can use to make import faster,
>e.g. command line import option ?
>Thanks in advance.
>Ming
>.
>

import a dynamic file name into a known table

How would I import a dynamic file name into a known table?

I have the file name in a variable. So what object in SSIS do I use to do this.

Thanks

If you just want to insert file name into table, why do you need SSIS? You can just use an insert command which takes the file name variable as parameter.|||

I have inherited a SSIS package that does massive amounts of importing, so I am trying to stay with the way it eas done.

Out of curiosity how woul I do what you said? How would I do it in SSIS?

Import a DTS package?

Hi all,
I exported a dts package to a *.dts file, but now's
the question how do i import such a package in
SQL Server again...
Does anybody know that?
cheersOriginally posted by rgndrp
Hi all,
I exported a dts package to a *.dts file, but now's
the question how do i import such a package in
SQL Server again...

Does anybody know that?

cheers

In sql server you can make a right click on dts in Enterprise manager un select task open package.
The select the package.

If your are using ms sql 7 be sure that your server is up to date.|||thnx alot

import a dts package

Hi i was wodering how can i transfer a developed dts package from sqlserver
to an installed MSDE2000.
Hi Yaniv,
Easiest is probably to save it to a file, and run the file using dtsrun
(which does come with the MSDE).
HTH,
Greg Low [MVP]
MSDE Manager SQL Tools
www.whitebearconsulting.com
"yaniv" <yaniv@.discussions.microsoft.com> wrote in message
news:43B7014E-41A4-4534-8249-D2B32E6225C1@.microsoft.com...
> Hi i was wodering how can i transfer a developed dts package from
> sqlserver
> to an installed MSDE2000.
>
|||nevermind found a way.
a simple VBScript that imports the file.dts :
Const DTSSQLStgFlag_UseTrustedConnection = 256
dim ServerName,dtsFilePath,userPassword
Dim dtsp, dtsPkg
ServerName = "server"
dtsFilePath = "d:\path\File.dts"
userPassword = ""
Set dtsPkg = CreateObject("DTS.Package")
dtsp = dtsPkg.LoadFromStorageFile(dtsFilePath,userPasswor d)
dtsPkg.SaveToSQLServer ServerName, "","" ,DTSSQLStgFlag_UseTrustedConnection
|||Hi Greg,
I have installed latest MSDE 2000 Rel A.
I do not see and file named dtsrun.
What am I missing?
Thanks
"Greg Low [MVP]" wrote:

> Hi Yaniv,
> Easiest is probably to save it to a file, and run the file using dtsrun
> (which does come with the MSDE).
> HTH,
> --
> Greg Low [MVP]
> MSDE Manager SQL Tools
> www.whitebearconsulting.com
> "yaniv" <yaniv@.discussions.microsoft.com> wrote in message
> news:43B7014E-41A4-4534-8249-D2B32E6225C1@.microsoft.com...
>
>
|||Nevermind. My mistake. Thanks
"Subhojit Banerjee" wrote:
[vbcol=seagreen]
> Hi Greg,
> I have installed latest MSDE 2000 Rel A.
> I do not see and file named dtsrun.
> What am I missing?
> Thanks
>
> "Greg Low [MVP]" wrote:

Import a database with .net framework data provider for ODBC

mHello all,
i have to import a database (micro focus files with idx-files) with an obdc
driver. When I use the assistant, I choose ".net framework data provider for
ODBC". In the next window I am asked for the connection string an driver. How
can I specify the driver to be used and the location of the original
databaseIn SQL 2000 it was quite easy using the ODBC Connection manager, but
in SQL 2005 I cant find the drivers. Any help or link to a documentation
appreciated. Thank you.
I have the same problem, did you ever find the fix for this?
i have to import a database (micro focus files with idx-files) with an obdc
driver. When I use the assistant, I choose ".net framework data provider for
ODBC". In the next window I am asked for the connection string an driver. How
can I specify the driver to be used and the location of the original
databaseIn SQL 2000 it was quite easy using the ODBC Connection manager, but
in SQL 2005 I cant find the drivers. Any help or link to a documentation
appreciated. Thank you.[/quote]

Import a database with .net framework data provider for ODBC

mHello all,
i have to import a database (micro focus files with idx-files) with an obdc
driver. When I use the assistant, I choose ".net framework data provider for
ODBC". In the next window I am asked for the connection string an driver. Ho
w
can I specify the driver to be used and the location of the original
databaseIn SQL 2000 it was quite easy using the ODBC Connection manager, but
in SQL 2005 I cant find the drivers. Any help or link to a documentation
appreciated. Thank you.I have the same problem, did you ever find the fix for this'
i have to import a database (micro focus files with idx-files) with an
obdc
driver. When I use the assistant, I choose ".net framework data
provider for
ODBC". In the next window I am asked for the connection string an
driver. How
can I specify the driver to be used and the location of the original
databaseIn SQL 2000 it was quite easy using the ODBC Connection
manager, but
in SQL 2005 I cant find the drivers. Any help or link to a
documentation
appreciated. Thank you.
RCranston

Import a database into SQL Server.

I need to import an SQL database into SQL express 2005. The database was created with an older edition of Sql Server. I need to import the database onto a server that only supports SQL 2005, and I have the express edition. Can it be done with transact SQL. I know very little about transact SQL and I dont mind very long answer with lots of explination.

hi,

if you have the physical files that made up the database, you can copy them on the new server and "attach" them as a new database... SQL Server Management Studio Express, the free graphical tool you can download from http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en provide a simply way to do it.. just right click the "Databases" node, "Attach".. you will be prompted with a dialog where you have to provide the full path of the primary data file of the database you want to attach (.Mdf file).. the transaction log file will be "selected" for you if available in the same folder ... specify the database name as required...

you have then to modify the database owner... refresh the database list, access the relative database "properties" and set the database owner to a valid principal... then go to the "Options" tab and set the database compatibility level to SQL Server 2005 (90)..

you can perform these steps via standard Transact-SQL statements as well..

see the CREATE DATABASE ... FOR ATTACH syntax at http://msdn2.microsoft.com/en-us/library/ms176061.aspx for attaching the database, sp_dbcmptlevel sytem stored procedure at http://msdn2.microsoft.com/en-us/library/ms178653.aspx to modify the database compatibility level and, finally, sp_changedbowner ystem stored procedure at http://msdn2.microsoft.com/en-us/library/ms178630.aspx to set the database owner...

then you have to update statistic, http://msdn2.microsoft.com/en-us/library/ms187348.aspx... for each table in the database perform the update with fullscan: open a query windows and execute the statement for each table...

UPDATE STATISTICS Sales.SalesOrderDetail WITH FULLSCAN;

regards

import a cube created in AS 2000 into SSAA 2005

Is there any way to import a cube created in AS 2000 into SSAA 2005? If not
a direct import is there any way to make that job easier? Any
suggestions/pointer/comments would be helpful. I have a lot of AS 2000 cube
s
and I am really sick of that development environment!there is no import option
you can try to upgrade your AS2000 server to AS2005.
install AS2000 on a new server, restore your databases and try to upgrade.
if you are a lucky man, then the install can upgrade the cubes, if not, then
there is no choice, you must recreate your cubes.
and, personnaly, I recommend a complete redesign of the cubes because there
is a lot of changes between the 2 versions.
this takes some times, but insure that your cubes will works fine and take
adavnatge of the new capabilities.
"maddog" <maddog@.discussions.microsoft.com> wrote in message
news:125B0852-A1BD-4254-BD29-5F4FC4B9B867@.microsoft.com...
> Is there any way to import a cube created in AS 2000 into SSAA 2005? If
> not
> a direct import is there any way to make that job easier? Any
> suggestions/pointer/comments would be helpful. I have a lot of AS 2000
> cubes
> and I am really sick of that development environment!

import a CSV delimited text file into a table

Hi,

Could you help me to write a script to import a CSV delimited text file into a sql server table.?

Thanks,

carlos

Hi,

you can use either a linked server or OPENQUERY for ahhoc querying the data, or the Import wizard of Management Studio. A sample of this would be:

http://p2p.wrox.com/topic.asp?TOPIC_ID=20163

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Thanks Jens, but it is too complex.

I am using BULK INSERT, but now I have a problem when a try to load a DATE value, I get error

Msg 4864, Level 16, State 1, Line 2

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 4 (EffectiveDate).

The script is

BULK INSERT grouppolicy

FROM 'C:\datatoload\test.txt'

WITH (

FIELDTERMINATOR = '\t',

ROWTERMINATOR = '\n'

)

Can Somebody help me

Thanks,

Import a COM+ application That depends on SQLNCLI on 32 bit XP Fails.

We have a 32 bit COM+ application that depends on SQLNCLI.DLL for BCP functionality. We are upgrading to the SQL Server Native client and moving away from ODBCBCP.dll.

Anyone running 32 bit XP attempting to import the COM+ application gets the following message: The DLL could not be loaded. Check to make sure all required application runtime files and other dependent DLLs are available in the component DLL's directory or the system path.

If I revert the DLL back to using ODBCBCP.dll the application will import and run fine. Here is the interesting part. If I import the application with the ODBCBCP.dll then rebuild the DLL so it links against SQLNCLI.DLL the app will run fine. It has no problem finding and loading SQLNCLI.DLL along with all of it's dependencies.

Anyone running 64 bit XP can import the COM+ application when the DLL is linked against SQLNCLI.DLL.

Does anyone have any insight into this issue. It is causing our developers alot of headache. If sample code is needed I will be glad to provide it, but only at request.

Thanks for your time,
Mike

To use the bcp APIs you have to link with a .lib that has the bcp API entry points because they are not accessed through the driver manager like mainstream ODBC APIs. With the MDAC 'SQL Server' driver you have to link with odbcbcp.lib and the bcp APIs are in a seperate odbcbcp.dll. With 'SQL Native Client' you have to link with sqlncli.lib - for SQL Native Client we put everything into a single dll - APIs, bcp and netlibs. If an app is linked with odbcbcp.lib but loads sqlsrv32.dll (or links with sqlncli.lib and loads sqlsrv32.dll) then you get an error when you load the app.

This is covered in Books Online in the topic which deals with upgrading applicatsion from MDAC to SQL Native Client(http://msdn2.microsoft.com/en-us/library/ms131035.aspx), which says:

"SQL Native client is not compatible with odbcbcp.dll. Applications which use both ODBC and bcp APIs must be rebuilt to link with sqlncli.lib in order to use SQL Native Client."

Applications which use only the 'standard' ODBC calls only link with the driver manager (odbc32.dll) so don't have a dependency on the driver dll (or bcp dll).

|||I was aware of that and made sure that our entire app only linked with sqlncli.lib. I changed that DLL to be delay loaded and our problem went away and the app runs fine.

import a backup to SqlServer 2005

Hi,
this might be a pretty ovious question but anyhow
I created a backup file of my Databases in SQLserver 2000
How can i load these into SqlSErver 2005 that I just installed
I always seem to get errors...
thxYes, it is possible to restore a SQL 2000 backup to SQL 2005. The database
will be upgraded to 2005 during the process. What errors are you getting?
Consider using the SQL Server 2005 Upgrade Adviser to analyze the
database(s) before the upgrade. SQL 2005 is a major release and some
applications may be affected by breaking changes. Be sure to peruse the
Upgrading to SQL Server 2005 topic in the Books Online
<ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/instsql9/html/f7e79c63-875a-446c-9860
-439486928ba1.htm>.
Hope this helps.
Dan Guzman
SQL Server MVP
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:0E4CAC91-B775-4B1E-A256-B1652479CE5C@.microsoft.com...
> Hi,
> this might be a pretty ovious question but anyhow
> I created a backup file of my Databases in SQLserver 2000
> How can i load these into SqlSErver 2005 that I just installed
> I always seem to get errors...
> thx|||Thx
in meantime i got it working
I was getting the error that i was restoring the data from another database
and that it could not work
but by overwriting the destination DB it worked fine and all data is fully
operational
thanx anyway..
"Dan Guzman" wrote:

> Yes, it is possible to restore a SQL 2000 backup to SQL 2005. The databas
e
> will be upgraded to 2005 during the process. What errors are you getting?
> Consider using the SQL Server 2005 Upgrade Adviser to analyze the
> database(s) before the upgrade. SQL 2005 is a major release and some
> applications may be affected by breaking changes. Be sure to peruse the
> Upgrading to SQL Server 2005 topic in the Books Online
> <ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/instsql9/html/f7e79c63-875a-446c-98
60-439486928ba1.htm>.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "benoit" <benoit@.discussions.microsoft.com> wrote in message
> news:0E4CAC91-B775-4B1E-A256-B1652479CE5C@.microsoft.com...
>
>

IMPORT A .TXT FILE INTO TABLE

I am looking to import a text file into a already
exisiting table(no data) via syntax SQL. I am just not
sure of the code.
could it be something like:
INSERT MY_FILE.TXT INTO MY_TABLE
I really appriciate your helpThis is a multi-part message in MIME format.
--=_NextPart_000_00E3_01C34C6A.735A2DC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Check out BULK INSERT or bcp in the BOL.
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"jon" <jon@.mybossisken.com> wrote in message =news:014701c34c8b$573349d0$a401280a@.phx.gbl...
I am looking to import a text file into a already exisiting table(no data) via syntax SQL. I am just not sure of the code.
could it be something like:
INSERT MY_FILE.TXT INTO MY_TABLE
I really appriciate your help
--=_NextPart_000_00E3_01C34C6A.735A2DC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Check out BULK INSERT or bcp in the BOL.
-- Tom
---T=homas A. Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL =Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql
"jon" wrote in message news:014701c34c8b$57=3349d0$a401280a@.phx.gbl...I am looking to import a text file into a already exisiting table(no =data) via syntax SQL. I am just not sure of the code.could it be =something like:INSERT MY_FILE.TXT INTO MY_TABLEI really appriciate =your help

--=_NextPart_000_00E3_01C34C6A.735A2DC0--

import 1 mln records = QA is hung up

Hi
I encountered a problem when I'm trying to import data from a flat table to
several tables of the same databases.
There are about 1 mln records inside the flat table called XX_ZRODLO. The
stored procedure for import seems to work and import data but after about
15000 it stops and it seems as though QA is hung up.
After restart of SQL and shutdown QA - the procedure for import can import
another about 30000 records and then the same agian QA is dead ...
Where could be the problem?
This is the procedure to import data (1 mln records) from table XX_ZRODLO to
several tables of databases according to its structure.
CREATE procedure XX_IMPORT
as
--##### SEKCJA DEKLARACJI
declare @.nazwa nvarchar(255)
declare @.id int
declare @.id_woj int
declare @.id_miasto int
declare @.ulica nvarchar(255)
declare @.telefon nvarchar(255)
declare @.id_branza int
declare @.www nvarchar(255)
declare @.mail nvarchar(255)
--nowo dodane
declare @.kod nvarchar(255)
declare @.numer_pos nvarchar(255)
declare @.kierunkowy nvarchar(255)
declare @.tb_firma_identity int
declare @.tb_adres_identity int
--koniec
declare @.id_firma int
declare @.id_adres int
set @.nazwa = ''
set @.id = 0
set @.id_woj = 0
set @.id_miasto=0
set @.ulica=''
set @.telefon=''
set @.kierunkowy=''
set @.id_branza=0
set @.www=''
set @.mail=''
--nowo dodane
set @.kod = ''
set @.numer_pos =''
set @.kierunkowy =''
--koniec
-- ####### KONIEC SEKCJI DEKLARACJI
--######## POCZATEK
begin
declare tb cursor for (select
nazwa,id,id_woj,id_miasto,ulica,telefon,id_branza,www,mail,kod,numer_pos,kierunkowy
from xx_zrodlo where id_portal is null)
open tb
fetch next from tb into
@.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.telefon,@.id_branza,@.www,@.mail,@.kod,@.numer_pos,@.kierunkowy
while @.@.fetch_status = 0
begin
IF @.id_miasto <>0 AND @.id_miasto is not NULL AND @.id_woj<>0 AND @.id_woj is
not NULL AND @.id_branza<>0 AND @.id_branza is not NULL
BEGIN
INSERT INTO TB_FIRMA (nazwa_firma,import) VALUES (@.nazwa,@.id)
select @.@.Identity
set @.tb_firma_identity = @.@.Identity
--select @.id_firma = max(idTB_FIRMA) FROM TB_FIRMA
UPDATE XX_ZRODLO set id_portal = 1 where id=@.id
INSERT INTO TB_FIRMA_BRANZA (idTB_FIRMA, idTB_BRANZA, HIERARCHIA,import)
VALUES (@.tb_firma_identity,@.id_branza,30000,1)
INSERT INTO TB_ADRES (ulica,nr_adresowy,kod,idTB_MIEJSOWOSC) VALUES
(@.ulica,@.numer_pos,@.kod,@.id_miasto)
select @.@.Identity
set @.tb_adres_identity = @.@.Identity
--select @.id_adres = max(idTB_ADRES) from TB_ADRES
INSERT INTO TB_ADRES_FIRMA (idTB_FIRMA,idTB_ADRES,import) VALUES
(@.tb_firma_identity,@.tb_adres_identity,1)
--przypadek telefonu komórkowego
--IF substring(@.telefon,1,1) = 0
IF @.kierunkowy = 0
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.telefon,5,@.tb_adres_identity,1)
END
--przypadek telefonu stacjonarnego
--IF substring(@.telefon,1,1) != 0
IF @.kierunkowy <>0 AND @.kierunkowy is not null
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.telefon,2,@.tb_adres_identity,1)
END
--przypadek adresu www
IF len(@.www) > 1
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.www,3,@.tb_adres_identity,1)
END
--przypadek adresu email
IF len(@.mail) > 1
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.mail,4,@.tb_adres_identity,1)
END
END
fetch next from tb into
@.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.telefon,@.id_branza,@.www,@.mail,@.kod,@.numer_pos,@.kierunkowy
END
end
close tb
deallocate tb
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GOHi
It seems that the id column is a natural key for this and therefore you
could do this using set based operations and not a cursor. This would speed
up your process.
John
"Dariusz Tomon" <d.tomon@.mazars.pl> wrote in message
news:%23Qw81E1zGHA.3512@.TK2MSFTNGP04.phx.gbl...
> Hi
> I encountered a problem when I'm trying to import data from a flat table
> to several tables of the same databases.
> There are about 1 mln records inside the flat table called XX_ZRODLO. The
> stored procedure for import seems to work and import data but after about
> 15000 it stops and it seems as though QA is hung up.
> After restart of SQL and shutdown QA - the procedure for import can import
> another about 30000 records and then the same agian QA is dead ...
> Where could be the problem?
> This is the procedure to import data (1 mln records) from table XX_ZRODLO
> to several tables of databases according to its structure.
> CREATE procedure XX_IMPORT
> as
> --##### SEKCJA DEKLARACJI
> declare @.nazwa nvarchar(255)
> declare @.id int
> declare @.id_woj int
> declare @.id_miasto int
> declare @.ulica nvarchar(255)
> declare @.telefon nvarchar(255)
> declare @.id_branza int
> declare @.www nvarchar(255)
> declare @.mail nvarchar(255)
> --nowo dodane
> declare @.kod nvarchar(255)
> declare @.numer_pos nvarchar(255)
> declare @.kierunkowy nvarchar(255)
> declare @.tb_firma_identity int
> declare @.tb_adres_identity int
> --koniec
> declare @.id_firma int
> declare @.id_adres int
> set @.nazwa = ''
> set @.id = 0
> set @.id_woj = 0
> set @.id_miasto=0
> set @.ulica=''
> set @.telefon=''
> set @.kierunkowy=''
> set @.id_branza=0
> set @.www=''
> set @.mail=''
> --nowo dodane
> set @.kod = ''
> set @.numer_pos =''
> set @.kierunkowy =''
> --koniec
> -- ####### KONIEC SEKCJI DEKLARACJI
>
> --######## POCZATEK
> begin
>
> declare tb cursor for (select
> nazwa,id,id_woj,id_miasto,ulica,telefon,id_branza,www,mail,kod,numer_pos,kierunkowy
> from xx_zrodlo where id_portal is null)
>
> open tb
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.telefon,@.id_branza,@.www,@.mail,@.kod,@.numer_pos,@.kierunkowy
> while @.@.fetch_status = 0
> begin
>
> IF @.id_miasto <>0 AND @.id_miasto is not NULL AND @.id_woj<>0 AND @.id_woj is
> not NULL AND @.id_branza<>0 AND @.id_branza is not NULL
> BEGIN
> INSERT INTO TB_FIRMA (nazwa_firma,import) VALUES (@.nazwa,@.id)
> select @.@.Identity
> set @.tb_firma_identity = @.@.Identity
> --select @.id_firma = max(idTB_FIRMA) FROM TB_FIRMA
> UPDATE XX_ZRODLO set id_portal = 1 where id=@.id
> INSERT INTO TB_FIRMA_BRANZA (idTB_FIRMA, idTB_BRANZA, HIERARCHIA,import)
> VALUES (@.tb_firma_identity,@.id_branza,30000,1)
> INSERT INTO TB_ADRES (ulica,nr_adresowy,kod,idTB_MIEJSOWOSC) VALUES
> (@.ulica,@.numer_pos,@.kod,@.id_miasto)
> select @.@.Identity
> set @.tb_adres_identity = @.@.Identity
> --select @.id_adres = max(idTB_ADRES) from TB_ADRES
> INSERT INTO TB_ADRES_FIRMA (idTB_FIRMA,idTB_ADRES,import) VALUES
> (@.tb_firma_identity,@.tb_adres_identity,1)
> --przypadek telefonu komórkowego
> --IF substring(@.telefon,1,1) = 0
> IF @.kierunkowy = 0
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,5,@.tb_adres_identity,1)
> END
> --przypadek telefonu stacjonarnego
> --IF substring(@.telefon,1,1) != 0
> IF @.kierunkowy <>0 AND @.kierunkowy is not null
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,2,@.tb_adres_identity,1)
> END
> --przypadek adresu www
> IF len(@.www) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.www,3,@.tb_adres_identity,1)
> END
> --przypadek adresu email
> IF len(@.mail) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.mail,4,@.tb_adres_identity,1)
> END
> END
>
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.telefon,@.id_branza,@.www,@.mail,@.kod,@.numer_pos,@.kierunkowy
> END
> end
> close tb
> deallocate tb
>
> GO
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS ON
> GO
>
>|||Dariusz Tomon wrote:
> Hi
> I encountered a problem when I'm trying to import data from a flat table to
> several tables of the same databases.
> There are about 1 mln records inside the flat table called XX_ZRODLO. The
> stored procedure for import seems to work and import data but after about
> 15000 it stops and it seems as though QA is hung up.
> After restart of SQL and shutdown QA - the procedure for import can import
> another about 30000 records and then the same agian QA is dead ...
> Where could be the problem?
> This is the procedure to import data (1 mln records) from table XX_ZRODLO to
> several tables of databases according to its structure.
> CREATE procedure XX_IMPORT
> as
> --##### SEKCJA DEKLARACJI
> declare @.nazwa nvarchar(255)
> declare @.id int
> declare @.id_woj int
> declare @.id_miasto int
> declare @.ulica nvarchar(255)
> declare @.telefon nvarchar(255)
> declare @.id_branza int
> declare @.www nvarchar(255)
> declare @.mail nvarchar(255)
> --nowo dodane
> declare @.kod nvarchar(255)
> declare @.numer_pos nvarchar(255)
> declare @.kierunkowy nvarchar(255)
> declare @.tb_firma_identity int
> declare @.tb_adres_identity int
> --koniec
> declare @.id_firma int
> declare @.id_adres int
> set @.nazwa = ''
> set @.id = 0
> set @.id_woj = 0
> set @.id_miasto=0
> set @.ulica=''
> set @.telefon=''
> set @.kierunkowy=''
> set @.id_branza=0
> set @.www=''
> set @.mail=''
> --nowo dodane
> set @.kod = ''
> set @.numer_pos =''
> set @.kierunkowy =''
> --koniec
> -- ####### KONIEC SEKCJI DEKLARACJI
>
> --######## POCZATEK
> begin
>
> declare tb cursor for (select
> nazwa,id,id_woj,id_miasto,ulica,telefon,id_branza,www,mail,kod,numer_pos,kierunkowy
> from xx_zrodlo where id_portal is null)
>
> open tb
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.telefon,@.id_branza,@.www,@.mail,@.kod,@.numer_pos,@.kierunkowy
> while @.@.fetch_status = 0
> begin
>
> IF @.id_miasto <>0 AND @.id_miasto is not NULL AND @.id_woj<>0 AND @.id_woj is
> not NULL AND @.id_branza<>0 AND @.id_branza is not NULL
> BEGIN
> INSERT INTO TB_FIRMA (nazwa_firma,import) VALUES (@.nazwa,@.id)
> select @.@.Identity
> set @.tb_firma_identity = @.@.Identity
> --select @.id_firma = max(idTB_FIRMA) FROM TB_FIRMA
> UPDATE XX_ZRODLO set id_portal = 1 where id=@.id
> INSERT INTO TB_FIRMA_BRANZA (idTB_FIRMA, idTB_BRANZA, HIERARCHIA,import)
> VALUES (@.tb_firma_identity,@.id_branza,30000,1)
> INSERT INTO TB_ADRES (ulica,nr_adresowy,kod,idTB_MIEJSOWOSC) VALUES
> (@.ulica,@.numer_pos,@.kod,@.id_miasto)
> select @.@.Identity
> set @.tb_adres_identity = @.@.Identity
> --select @.id_adres = max(idTB_ADRES) from TB_ADRES
> INSERT INTO TB_ADRES_FIRMA (idTB_FIRMA,idTB_ADRES,import) VALUES
> (@.tb_firma_identity,@.tb_adres_identity,1)
> --przypadek telefonu komórkowego
> --IF substring(@.telefon,1,1) = 0
> IF @.kierunkowy = 0
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,5,@.tb_adres_identity,1)
> END
> --przypadek telefonu stacjonarnego
> --IF substring(@.telefon,1,1) != 0
> IF @.kierunkowy <>0 AND @.kierunkowy is not null
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,2,@.tb_adres_identity,1)
> END
> --przypadek adresu www
> IF len(@.www) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.www,3,@.tb_adres_identity,1)
> END
> --przypadek adresu email
> IF len(@.mail) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.mail,4,@.tb_adres_identity,1)
> END
> END
>
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.telefon,@.id_branza,@.www,@.mail,@.kod,@.numer_pos,@.kierunkowy
> END
> end
> close tb
> deallocate tb
>
> GO
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS ON
> GO
>
>
Launch another QA session and look at the sysprocesses table - is there
blocking? Does the spid that your import is using show a waittype? Are
you see a delay due to autogrow?
Tracy McKibben
MCDBA
http://www.realsqlguy.com

import 1 mln records = QA is hung up

Hi
I encountered a problem when I'm trying to import data from a flat table to
several tables of the same databases.
There are about 1 mln records inside the flat table called XX_ZRODLO. The
stored procedure for import seems to work and import data but after about
15000 it stops and it seems as though QA is hung up.
After restart of SQL and shutdown QA - the procedure for import can import
another about 30000 records and then the same agian QA is dead ...
Where could be the problem?
This is the procedure to import data (1 mln records) from table XX_ZRODLO to
several tables of databases according to its structure.
CREATE procedure XX_IMPORT
as
--##### SEKCJA DEKLARACJI
declare @.nazwa nvarchar(255)
declare @.id int
declare @.id_woj int
declare @.id_miasto int
declare @.ulica nvarchar(255)
declare @.telefon nvarchar(255)
declare @.id_branza int
declare @.www nvarchar(255)
declare @.mail nvarchar(255)
--nowo dodane
declare @.kod nvarchar(255)
declare @.numer_pos nvarchar(255)
declare @.kierunkowy nvarchar(255)
declare @.tb_firma_identity int
declare @.tb_adres_identity int
--koniec
declare @.id_firma int
declare @.id_adres int
set @.nazwa = ''
set @.id = 0
set @.id_woj = 0
set @.id_miasto=0
set @.ulica=''
set @.telefon=''
set @.kierunkowy=''
set @.id_branza=0
set @.www=''
set @.mail=''
--nowo dodane
set @.kod = ''
set @.numer_pos =''
set @.kierunkowy =''
--koniec
-- ####### KONIEC SEKCJI DEKLARACJI
--######## POCZATEK
begin
declare tb cursor for (select
nazwa,id,id_woj,id_miasto,ulica,telefon,
id_branza,www,mail,kod,numer_pos,kie
runkowy
from xx_zrodlo where id_portal is null)
open tb
fetch next from tb into
@.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.te
lefon,@.id_branza,@.www,@.mail,@.kod,@.nu
mer_pos,@.kierunkowy
while @.@.fetch_status = 0
begin
IF @.id_miasto <>0 AND @.id_miasto is not NULL AND @.id_woj<>0 AND @.id_woj is
not NULL AND @.id_branza<>0 AND @.id_branza is not NULL
BEGIN
INSERT INTO TB_FIRMA (nazwa_firma,import) VALUES (@.nazwa,@.id)
select @.@.Identity
set @.tb_firma_identity = @.@.Identity
--select @.id_firma = max(idTB_FIRMA) FROM TB_FIRMA
UPDATE XX_ZRODLO set id_portal = 1 where id=@.id
INSERT INTO TB_FIRMA_BRANZA (idTB_FIRMA, idTB_BRANZA, HIERARCHIA,import)
VALUES (@.tb_firma_identity,@.id_branza,30000,1)
INSERT INTO TB_ADRES (ulica,nr_adresowy,kod,idTB_MIEJSOWOSC) VALUES
(@.ulica,@.numer_pos,@.kod,@.id_miasto)
select @.@.Identity
set @.tb_adres_identity = @.@.Identity
--select @.id_adres = max(idTB_ADRES) from TB_ADRES
INSERT INTO TB_ADRES_FIRMA (idTB_FIRMA,idTB_ADRES,import) VALUES
(@.tb_firma_identity,@.tb_adres_identity,1
)
--przypadek telefonu komrkowego
--IF substring(@.telefon,1,1) = 0
IF @.kierunkowy = 0
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.telefon,5,@.tb_adres_identity,1)
END
--przypadek telefonu stacjonarnego
--IF substring(@.telefon,1,1) != 0
IF @.kierunkowy <>0 AND @.kierunkowy is not null
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.telefon,2,@.tb_adres_identity,1)
END
--przypadek adresu www
IF len(@.www) > 1
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.www,3,@.tb_adres_identity,1)
END
--przypadek adresu email
IF len(@.mail) > 1
BEGIN
INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
VALUES
(@.mail,4,@.tb_adres_identity,1)
END
END
fetch next from tb into
@.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.te
lefon,@.id_branza,@.www,@.mail,@.kod,@.nu
mer_pos,@.kierunkowy
END
end
close tb
deallocate tb
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GOHi
It seems that the id column is a natural key for this and therefore you
could do this using set based operations and not a cursor. This would speed
up your process.
John
"Dariusz Tomon" <d.tomon@.mazars.pl> wrote in message
news:%23Qw81E1zGHA.3512@.TK2MSFTNGP04.phx.gbl...
> Hi
> I encountered a problem when I'm trying to import data from a flat table
> to several tables of the same databases.
> There are about 1 mln records inside the flat table called XX_ZRODLO. The
> stored procedure for import seems to work and import data but after about
> 15000 it stops and it seems as though QA is hung up.
> After restart of SQL and shutdown QA - the procedure for import can import
> another about 30000 records and then the same agian QA is dead ...
> Where could be the problem?
> This is the procedure to import data (1 mln records) from table XX_ZRODLO
> to several tables of databases according to its structure.
> CREATE procedure XX_IMPORT
> as
> --##### SEKCJA DEKLARACJI
> declare @.nazwa nvarchar(255)
> declare @.id int
> declare @.id_woj int
> declare @.id_miasto int
> declare @.ulica nvarchar(255)
> declare @.telefon nvarchar(255)
> declare @.id_branza int
> declare @.www nvarchar(255)
> declare @.mail nvarchar(255)
> --nowo dodane
> declare @.kod nvarchar(255)
> declare @.numer_pos nvarchar(255)
> declare @.kierunkowy nvarchar(255)
> declare @.tb_firma_identity int
> declare @.tb_adres_identity int
> --koniec
> declare @.id_firma int
> declare @.id_adres int
> set @.nazwa = ''
> set @.id = 0
> set @.id_woj = 0
> set @.id_miasto=0
> set @.ulica=''
> set @.telefon=''
> set @.kierunkowy=''
> set @.id_branza=0
> set @.www=''
> set @.mail=''
> --nowo dodane
> set @.kod = ''
> set @.numer_pos =''
> set @.kierunkowy =''
> --koniec
> -- ####### KONIEC SEKCJI DEKLARACJI
>
> --######## POCZATEK
> begin
>
> declare tb cursor for (select
> nazwa,id,id_woj,id_miasto,ulica,telefon,
id_branza,www,mail,kod,numer_pos,k
ierunkowy
> from xx_zrodlo where id_portal is null)
>
> open tb
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.te
lefon,@.id_branza,@.www,@.mail,@.kod,@.
numer_pos,@.kierunkowy
> while @.@.fetch_status = 0
> begin
>
> IF @.id_miasto <>0 AND @.id_miasto is not NULL AND @.id_woj<>0 AND @.id_woj is
> not NULL AND @.id_branza<>0 AND @.id_branza is not NULL
> BEGIN
> INSERT INTO TB_FIRMA (nazwa_firma,import) VALUES (@.nazwa,@.id)
> select @.@.Identity
> set @.tb_firma_identity = @.@.Identity
> --select @.id_firma = max(idTB_FIRMA) FROM TB_FIRMA
> UPDATE XX_ZRODLO set id_portal = 1 where id=@.id
> INSERT INTO TB_FIRMA_BRANZA (idTB_FIRMA, idTB_BRANZA, HIERARCHIA,import)
> VALUES (@.tb_firma_identity,@.id_branza,30000,1)
> INSERT INTO TB_ADRES (ulica,nr_adresowy,kod,idTB_MIEJSOWOSC) VALUES
> (@.ulica,@.numer_pos,@.kod,@.id_miasto)
> select @.@.Identity
> set @.tb_adres_identity = @.@.Identity
> --select @.id_adres = max(idTB_ADRES) from TB_ADRES
> INSERT INTO TB_ADRES_FIRMA (idTB_FIRMA,idTB_ADRES,import) VALUES
> (@.tb_firma_identity,@.tb_adres_identity,1
)
> --przypadek telefonu komrkowego
> --IF substring(@.telefon,1,1) = 0
> IF @.kierunkowy = 0
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,5,@.tb_adres_identity,1)
> END
> --przypadek telefonu stacjonarnego
> --IF substring(@.telefon,1,1) != 0
> IF @.kierunkowy <>0 AND @.kierunkowy is not null
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,2,@.tb_adres_identity,1)
> END
> --przypadek adresu www
> IF len(@.www) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.www,3,@.tb_adres_identity,1)
> END
> --przypadek adresu email
> IF len(@.mail) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.mail,4,@.tb_adres_identity,1)
> END
> END
>
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.te
lefon,@.id_branza,@.www,@.mail,@.kod,@.
numer_pos,@.kierunkowy
> END
> end
> close tb
> deallocate tb
>
> GO
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS ON
> GO
>
>|||Dariusz Tomon wrote:
> Hi
> I encountered a problem when I'm trying to import data from a flat table t
o
> several tables of the same databases.
> There are about 1 mln records inside the flat table called XX_ZRODLO. The
> stored procedure for import seems to work and import data but after about
> 15000 it stops and it seems as though QA is hung up.
> After restart of SQL and shutdown QA - the procedure for import can import
> another about 30000 records and then the same agian QA is dead ...
> Where could be the problem?
> This is the procedure to import data (1 mln records) from table XX_ZRODLO
to
> several tables of databases according to its structure.
> CREATE procedure XX_IMPORT
> as
> --##### SEKCJA DEKLARACJI
> declare @.nazwa nvarchar(255)
> declare @.id int
> declare @.id_woj int
> declare @.id_miasto int
> declare @.ulica nvarchar(255)
> declare @.telefon nvarchar(255)
> declare @.id_branza int
> declare @.www nvarchar(255)
> declare @.mail nvarchar(255)
> --nowo dodane
> declare @.kod nvarchar(255)
> declare @.numer_pos nvarchar(255)
> declare @.kierunkowy nvarchar(255)
> declare @.tb_firma_identity int
> declare @.tb_adres_identity int
> --koniec
> declare @.id_firma int
> declare @.id_adres int
> set @.nazwa = ''
> set @.id = 0
> set @.id_woj = 0
> set @.id_miasto=0
> set @.ulica=''
> set @.telefon=''
> set @.kierunkowy=''
> set @.id_branza=0
> set @.www=''
> set @.mail=''
> --nowo dodane
> set @.kod = ''
> set @.numer_pos =''
> set @.kierunkowy =''
> --koniec
> -- ####### KONIEC SEKCJI DEKLARACJI
>
> --######## POCZATEK
> begin
>
> declare tb cursor for (select
> nazwa,id,id_woj,id_miasto,ulica,telefon,
id_branza,www,mail,kod,numer_pos,k
ierunkowy
> from xx_zrodlo where id_portal is null)
>
> open tb
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.te
lefon,@.id_branza,@.www,@.mail,@.kod,@.
numer_pos,@.kierunkowy
> while @.@.fetch_status = 0
> begin
>
> IF @.id_miasto <>0 AND @.id_miasto is not NULL AND @.id_woj<>0 AND @.id_woj is
> not NULL AND @.id_branza<>0 AND @.id_branza is not NULL
> BEGIN
> INSERT INTO TB_FIRMA (nazwa_firma,import) VALUES (@.nazwa,@.id)
> select @.@.Identity
> set @.tb_firma_identity = @.@.Identity
> --select @.id_firma = max(idTB_FIRMA) FROM TB_FIRMA
> UPDATE XX_ZRODLO set id_portal = 1 where id=@.id
> INSERT INTO TB_FIRMA_BRANZA (idTB_FIRMA, idTB_BRANZA, HIERARCHIA,import)
> VALUES (@.tb_firma_identity,@.id_branza,30000,1)
> INSERT INTO TB_ADRES (ulica,nr_adresowy,kod,idTB_MIEJSOWOSC) VALUES
> (@.ulica,@.numer_pos,@.kod,@.id_miasto)
> select @.@.Identity
> set @.tb_adres_identity = @.@.Identity
> --select @.id_adres = max(idTB_ADRES) from TB_ADRES
> INSERT INTO TB_ADRES_FIRMA (idTB_FIRMA,idTB_ADRES,import) VALUES
> (@.tb_firma_identity,@.tb_adres_identity,1
)
> --przypadek telefonu komrkowego
> --IF substring(@.telefon,1,1) = 0
> IF @.kierunkowy = 0
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,5,@.tb_adres_identity,1)
> END
> --przypadek telefonu stacjonarnego
> --IF substring(@.telefon,1,1) != 0
> IF @.kierunkowy <>0 AND @.kierunkowy is not null
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.telefon,2,@.tb_adres_identity,1)
> END
> --przypadek adresu www
> IF len(@.www) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.www,3,@.tb_adres_identity,1)
> END
> --przypadek adresu email
> IF len(@.mail) > 1
> BEGIN
> INSERT INTO TB_KONTAKT (WARTOSC, idTB_NAZWA_KONTAKT, idTB_ADRES,import)
> VALUES
> (@.mail,4,@.tb_adres_identity,1)
> END
> END
>
> fetch next from tb into
> @.nazwa,@.id,@.id_woj,@.id_miasto,@.ulica,@.te
lefon,@.id_branza,@.www,@.mail,@.kod,@.
numer_pos,@.kierunkowy
> END
> end
> close tb
> deallocate tb
>
> GO
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS ON
> GO
>
>
Launch another QA session and look at the sysprocesses table - is there
blocking? Does the spid that your import is using show a waittype? Are
you see a delay due to autogrow?
Tracy McKibben
MCDBA
http://www.realsqlguy.com