Showing posts with label edition. Show all posts
Showing posts with label edition. Show all posts

Friday, March 23, 2012

Import Fixed-width data with DSNs

Ok, so I've been playing around with SQL Server 2005 64-bit Dev Edition in readiness to phase out my existing SQL 2000 box. I've been having difficulty with importing fixed-width text data with SSIS. To explain, we use a linux based ERP system which is stored in a non-standard, encrypted flat-file format. So, each evening, I have a cron job spin off some shell scripts that use the ERP's report tool dump all of the relevant databases I need into a fixed-width format text file. The ERP platform also has a db layout report which is also in text format, I use this file (mangle it with VB first) and dump it back out into the format used to make a DSN file.

DSN connector file (dbname.dsn)
[ODBC]
DRIVER=Microsoft Text Driver (*.txt; *.csv)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=text
Extensions=None,asc,csv,tab,txt
DriverID=27
DefaultDir=C:\ADVDB\IMPORTED\common\current\advdb009
DBQ=C:\ADVDB\IMPORTED\common\current\advdb009

Because ODBC/DSNs are nifty enough to use a schema.ini file to lookup the data types, length and field names, I used that same db layout file to generate that as well.

schema.ini:
[advdb009.txt]
Format=FixedLength
ColNameHeader=False
MaxScanRows=0
CharacterSet=OEM
Col1=AccountNumber Char Width 15
Col2=Description Char Width 41
Col3=ContraAccountNumber Char Width 15
Col4=Type Char Width 2
Col5=Status Char Width 2
Col6=PositionOnBalanceSheet Char Width 2
Col7=PostingStatus Char Width 2
Col8=JobCostingTemplate Char Width 2
Col9=DailyActivityAmount Float Width 15
*snip*

I then put this schema.ini file in the same directory as the text file containing the fixed-width data, and its ready to go. In 2000/DTS, I simply launch the import/export wizard, point my data source to "Other (ODBC Data Source)" and point to the DSN file I created. Select my destination as a new SQL table on my server. Then tell the import wizard to do a straight across data copy, no transformations (except drop the destination table)... Save it as a local DTS package and finish the wizard. Once the package is saved, I use dtsrun from a cmd line in a bunch of batch files to re-populate the updated data from my ERP system to SQL everynight at 3am. Next morning, I can run fresh reports on my sales, inventory and financials from data of the previous day using Crystal or OLAP.

Now enters SSIS... Using the SSIS import wizard it does not give me the option to use a DSN source like DTS did. I've tried the .NET Framework for ODBC but it doesn't recognize the schema files, unless I'm not doing it right. Using the flatfile import method from SSIS requires that I hand enter the data types, widths and field name. As I have over 4000 fields across 26 tables, this is not practical. I also don't want to be required to hand-code a SSIS package in visual studio to resolve this, because again, I have to hand-code the schema when I already have it in a known ODBC schema file.

People have told me to use the DTS runner built into the SQL 2005, unfortunately my attempts to use it have failed mostly because the packages were written in SQL2000/32bit and I'm running the packages on 64-bit SQL 2005. They've given me alot of compile errors in visual studio. I also won't switch to a 32-bit version of SQL2005, because thats the whole point of moving to the new version and 64-bit technology, I want the extra horsepower and memory handling.

Has anyone else had this problem? Can anyone point me in the right direction on how to handle my import issue? I've picked up a few SSIS books but all they talk about is moving data back and forth with known server types and using the SSIS designer, nothing specific to working with fixed-width files, DSN or ODBC methods. Google searches has also ended nowhere due to the newness of SQL2005/SSIS.

Any help would be appreciated.


This is what I get when I attempt to use the ".NET Framework for ODBC" as a driver using the connection string:

Driver={Microsoft Text Driver (*.txt; *.csv)};dbq=C:\ADVDB\IMPORTED\common\current\advdb009
defaultdir=C:\ADVDB\IMPORTED\common\current\advdb009;driverid=27;extensions=None,asc,csv,tab,txt;fil=text;
filedsn=C:\AdvDB\dsn\common_advdb009.dsn;maxbuffersize=2048;maxscanrows=8;pagetimeout=5;
safetransactions=0;threads=3;uid=admin;usercommitsync=Yes

Tell the wizard to dump into a SQL Native Client on 2005. The data copy is grayed so I have to write a query. So, if I enter something simple like :

select accountnumber from advdb009.txt

or

select * from advdb009.txt

I get this :

===================================

The statement could not be parsed. (SQL Server Import and Export Wizard)

===================================

ERROR [HY000] [Microsoft][ODBC Text Driver] In the text file specification 'advdb009.txt', the Col1 option is invalid. (odbcjt32.dll)


Program Location:

at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcDataReader.get_FieldCount()
at System.Data.Odbc.OdbcDataReader.NewSchemaTable()
at System.Data.Odbc.OdbcDataReader.GetSchemaTable()
at Microsoft.SqlServer.Dts.DtsWizard.StepQuery.ParseStatement(Boolean bReportSuccess)

If Col1 isn't supported by .NET but it is with the old ODBC/DSN style, what *IS* supported?

|||Anyone have any input on this issue?|||

Use a DSN-less connection string and you'll be able to connect to an ODBC text driver from SSIS. Works in the wizard or in BIDS.

In the wizard, select the .NET Framework provider for ODBC. For the source connection string, write in your dsn-less connection string ( know it says Access, it will work):

uid=admin;Driver={Microsoft Access 12.0 Text Driver (*.txt, *.csv)};dbq=C:\data;defaultdir=C:\data;driverid=27;extensions=txt;fil=text;maxbuffersize=2048;maxscanrows=25;pagetimeout=5;safetransactions=0;threads=3;usercommitsync=Yes;

Pick your target.

Write the query that matches your schema.ini (e.g. select * from [advdb009.txt] ). Preview the data in the next tab.

If you're doing the same thing in the Business Intel Designer, create an ADO.NET connection manager using the .NET Framework provider for ODBC with the same connection string as the above. Create a dataflow, and for your source, use a DataReaderSource, setting the SqlCommand property to "select * from [advdb009.txt]".


|||

Well that got me closer. Funny thing is, when I get passed the destination part to the mappings, I can preview my data now. It looks great. All the columns are there with the proper schema. But, when I finish the wizard. It gets to the 4th step "Setting Source Connection" with a red x and It gives me this error message:

===================================

Could not set up data flow connections.

The connection string format is not valid. It must consist of one or more components of the form X=Y, separated by semicolons. This error occurs when a connection string with zero components is set on database connection manager.
(SQL Server Import and Export Wizard)

===================================

The connection string format is not valid. It must consist of one or more components of the form X=Y, separated by semicolons. This error occurs when a connection string with zero components is set on database connection manager.
({760BF532-15EE-4E4E-BA6D-287C511600B2})


Program Location:

at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSConnectionManager90.set_ConnectionString(String pbstrConnectionString)
at Microsoft.SqlServer.Dts.DtsWizard.Execute.SetupConnections(Exception& ex)

Followed by:

===================================

Could not connect source component.

Error 0xc0047062: Source - Query [1]: System.InvalidOperationException: The ConnectionString property has not been initialized.
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Dts.Runtime.ManagedHelper.GetManagedConnection(String assemblyQualifiedName, String connStr, Object transaction)
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSConnectionManager90.AcquireConnection(Object pTransaction)
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.AcquireConnections(Object transaction)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper90 wrapper, Object transaction) (SQL Server Import and Export Wizard)

===================================

The ConnectionString property has not been initialized. (Microsoft.SqlServer.DTSPipelineWrap)


Program Location:

at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Dts.Runtime.ManagedHelper.GetManagedConnection(String assemblyQualifiedName, String connStr, Object transaction)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HandleUserException(Exception e)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper90 wrapper, Object transaction)
at Microsoft.SqlServer.Dts.Pipeline.Wrapper.CManagedComponentWrapperClass.AcquireConnections(Object pTransaction)
at Microsoft.SqlServer.Dts.DtsWizard.Execute.SetSourceConnection(Exception& ex, TransformInfo ti)

I've read through my connection string atleast 2 dozen times and removed stuff that's not really needed to get the data. And it still generates that error message. So frustrating...

|||What is your exact connection string, at this point?|||

I fixed my problem... This was what I had to use for my connection string.

FILEDSN=C:\AdvDB\dsn\common_advdb009.dsn;Uid=admin;Pwd=;

The Access Text Driver you mentioned in your previous post didn't work. The system didn't recognize the driver itself (probably because I don't have it). I'm guessing that Text Driver is from a newer version of Access or something. I have Access from Office XP version. But I'm running VS2005/SQL2003. So if the driver came from Access 2003, that would explain why it wasn't recognized.

But, I tried the standard text driver I was using before and I was able to preview my data. You found goof I did with my sql syntax was the "select * from [advdb009.txt]", I was using it without the square brackets around advdb009.txt.

So now we get to why the DSNless connection wouldn't work. Here's my guess, which I didn't notice until I looked at the connection string for the 50th time. I think the SSIS wizard freaked out because the driver I was using said this:

{Microsoft Text Driver (*.txt; *.csv)}...

Which worked to allow me to preview the data but when the wizard tried to build the code, it failed saying it doesn't fall into proper format X=Y, etc. Well, you'll notice that there is a semi-colon between *.txt and *.csv. I feel that is what threw it off. Granted if I had the correct driver that you mentioned for Access 12.0, it may have worked, because the string you gave, had a comma seperating *.txt and *.csv. I even tested your string with a semi-colon to rule that out, but the driver was still not recognized. I even changed the regular text driver from semi-colon to comma, that didn't work either, said the driver could not be found. I always thought that if the string had the curly brackets around it, it was to take all string variables inside the brackets as one value. But, I guess the parser sees the semi-colon anyway and crashes. I'd consider this a bug in my opinion.

So, the answer was to use a DSN based connection string. Which is totally stupid because even in my DSN file itself, it contains the semi-colon in the driver parameter value...

[ODBC]
DRIVER=Microsoft Text Driver (*.txt; *.csv)
UID=admin
UserCommitSync=Yes

The parser doesn't like the semi-colon on the dsnless connection strings, but it'll handle it if it's being read in from a 3rd party file like I'm doing.

Totally appreciate your help, you got me pointed in the right direction of where the problem was.

Thanks alot! Now I finish building these bad boys and kill off my old SQL2000 box.

Wednesday, March 7, 2012

Import and Export Data Wizard missing in SQL Server 2005 Express Edition

After some weeks evaluating tools and platforms for developing an application, I decided to move to SQL Server 2005 Express Edition. Everything was fine till last night, when after creating my tables, I needed to populate them. I tried to find the Import and Export Data Wizard that SQL Server 7.0 and 2000 used to have, but great was my surprise when I found - in this forum - a post that said that it's not available in the Express Edition.

I'll have to move back in time (what I hate) to remember the way BCP worked. Can somebody post some examples to not start from zero ? Does anybody know a third party visual tool that can import/export data from text files to a SQL Server DB via ODBC ?

What's the reason it was not included in the EE ?

THanks !

Hi,

BCP is documented in Books Online.

SQL Express is a free product and not all features are included. In this version they removed the Import/Export wizard for a number of reasons. We're looking at alternative soluitons for a future version of SQL Express.

Mike Wachal
SQL Express team

|||

Hi,

First off, please excuse the lack of specific detail but it's been a while since I installed this feature -

there is an import/export facility in SQL Server Express edition but it's in the "Advanced Features/Services" version.

You have to do a "custom" install and the import feature is buried in one of the tree feature diagrams and is NOT selected by default.

Open all the feature trees and check out the hints for each of the features to find the one you're after - it's definitely there 'cos I've used it to import data from an Excel workbook and from Access.

Really simple to use and very effective!

Best of luck!

|||

Hi Steve,

There is no supported Import/Export functionality in any version of SQL Express. Some people have managed to get the old Import/Export wizard onto their computers, but it has not been tested and it is not supported. If you go down this path, you do so at your own risk. BCP on the other hand is tested and supported.

Mike

|||

Steve,

thanks a lot for your coment. I'll give it a try if I don't succeed with BCP. My deadline is almost over and I can't make BCP work (I'm getting some memory allocation errors whn running it).

MIke,

do you have any other reference to BCP ? I need some working examples rather than the explanation of every parameter.

Other thing I need to know is how can I check the current version I have installed. Before starting this thread, I had just installed SQL Server 2005 Express Edition complete (with Managment Studio, Advanced Services and Toolkit). A couple of days ago, I noticed there was a SP2 and installed it over the older one and I generated an Hybrid that didn't work, so I removed all the installations (restarted) and then installed just SQL Server 2005 Express Edition and Management Studio (nothing else yet).

THanks !

|||

Go into Add/Remove Programs, find Microsoft SQL Server 2005 and click Change. When the wizard opens, there should be a Report button, clicking this will give you a report of everything you have installed and what version it is.

Try these references for using BCP:

http://support.microsoft.com/default.aspx/kb/67409
http://www.devarticles.com/c/a/SQL-Server/An-Introduction-To-The-Bulk-Copy-Utility/

Mike

|||

Mike,

thanks for letting me know the way to check version. I'll check the BCP links now.

Before getting this answer, I tried the following (I'm a bit desperate ):

Sent all the txt files to a friend and he imported to a SLQ Server 2k database and then he sent it back to me. After that, I ran the following in my SQL Server 2005 EE :

CREATE DATABASE Bolsa ON
(FILENAME = 'u:\Bolsa de Santiago\CD Bolsa\Bolsa_Data.MDF'),
(FILENAME = 'u:\Bolsa de Santiago\CD Bolsa\Bolsa_Log.ldf')
FOR ATTACH;
GO

and got this error.

Msg 3415, Level 16, State 1, Line 1
Database 'Bolsa' cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.

Any hint on how to fix it ?

Thanks !

|||

Not sure what the U: drive is for you, if that is actually the CD drive, you will need to copy the files to a different directory since CDs are read-only. If that is not yoru CD drive, try...

Take a look at the properties of the files (right-click | Properties) to see if they are set to Read-only.

One final note, SQL Express does not support attaching files from network locations or mapped drives, they have to be on the local hard drive. Again, just wondering about that U: drive.

Mike

|||

Mike,

before posting the above, I checked the files weren't Read Only and they are not in a CD (also no network here). U: drive for me is a 4GB NTFS partition from my master HDD. Could be a problem if it's not on a FAT32 drive ? I'm running Windows XP Home Edition SP2 (spanish) and SQL Server 2005 Express Edition SP2 (english).

Bye !

|||

The KB article at http://support.microsoft.com/kb/931640 suggests that this issue is actually caused by a setting on the files created on your friends SQL 2K server. It seems like you'll need to check the properties of the database server your friend used to create the files.

It might be faster to finish down the path of figuring out your BCP issues rather than start troubleshooting a completely different problem.

Mike

|||

Hi folks,

with all deference to your knowledge, Mike, I have DTS installed on my (newish) PC and have only ever installed SQL Express with Advanced Features and the Toolkit..

Admittedly, it took some finding, but there it is at "C:\Program Files\Microsoft SQL Server\90\Binn\DTS\DTSWizard.exe".

From a pragmatic point of view, with deadlines approaching, perhaps rrudolph should try (custom) installing the Toolkit and checking out ALL the component trees?

Regards to all

Steve

|||

Hi Steve,

I'm just telling you that using that wizard in Express has not been tested, nor is it supported, so you use it at your own risk.

The amount of work in a project is the sum of the work to do it the first time and then to do it over to fix your mistakes. I find using unsupported technology is usually one of those mistakes that needs to be fixed later.

Mike

|||

Mike,

the good news are that finally made the BCP work.

I have uploaded most of the data I needed. Just missing some files that when uploading them to the database, I noticed they contained had corrupted data. Thanks a lot for your helpful tips, links and directions. (hope next time I have to deal with BCP, I have no problems).

Steve,

I'm planning, after ending this project to re-install everything from scratch and then I will try to add the Wizard you mentioned. My doubt is last Thursday I started both installation programs ("SQL Server 2005 Express Edition with Advanced Services SP2" and "Microsoft SQL Server 2005 Express Edition Toolkit SP2") but canceled them before they modify my curent config. In none of them I was able to find the Import and Export Wizard you mentioned. I opened all the branches I found in the custom setup. When you installed yours, did you use the SP2 installation files (it's fresh from February 2007) or the ones from previous release ?

Thanks a lot !

|||

Rrudolph,

glad you got BCP running ok.

I'm still running SP1. I think(?) the wizard was in the Toolkit..!

However, if you have cracked the problems with BCP you might want to stick with that - as Mike correctly points out this DTS seems to be an un-supported feature (though why it should be so is a mystery).

I'm in the fortunate position of producing small, bespoke stuff where speed/ease of development is more important to my boss than anything else so can "risk" going with DTS (which, I'll admit, works for me like a dream).

OK, this doesn't seem to be full-blown DTS from SQL2000/2005 but it's sure good enough for my requirements.

Regards

Steve

ps - if you want me to find exactly where DTS was contact me and I'll re-install on my home PC to see where everything is.

|||

Steve,

thanks a lot for the offer.

I've just modified my profile to make my email addy visible. Email me to this one.

THanks !

Import and Export Data Wizard missing in SQL Server 2005 Express Edition

After some weeks evaluating tools and platforms for developing an application, I decided to move to SQL Server 2005 Express Edition. Everything was fine till last night, when after creating my tables, I needed to populate them. I tried to find the Import and Export Data Wizard that SQL Server 7.0 and 2000 used to have, but great was my surprise when I found - in this forum - a post that said that it's not available in the Express Edition.

I'll have to move back in time (what I hate) to remember the way BCP worked. Can somebody post some examples to not start from zero ? Does anybody know a third party visual tool that can import/export data from text files to a SQL Server DB via ODBC ?

What's the reason it was not included in the EE ?

THanks !

Hi,

BCP is documented in Books Online.

SQL Express is a free product and not all features are included. In this version they removed the Import/Export wizard for a number of reasons. We're looking at alternative soluitons for a future version of SQL Express.

Mike Wachal
SQL Express team

|||

Hi,

First off, please excuse the lack of specific detail but it's been a while since I installed this feature -

there is an import/export facility in SQL Server Express edition but it's in the "Advanced Features/Services" version.

You have to do a "custom" install and the import feature is buried in one of the tree feature diagrams and is NOT selected by default.

Open all the feature trees and check out the hints for each of the features to find the one you're after - it's definitely there 'cos I've used it to import data from an Excel workbook and from Access.

Really simple to use and very effective!

Best of luck!

|||

Hi Steve,

There is no supported Import/Export functionality in any version of SQL Express. Some people have managed to get the old Import/Export wizard onto their computers, but it has not been tested and it is not supported. If you go down this path, you do so at your own risk. BCP on the other hand is tested and supported.

Mike

|||

Steve,

thanks a lot for your coment. I'll give it a try if I don't succeed with BCP. My deadline is almost over and I can't make BCP work (I'm getting some memory allocation errors whn running it).

MIke,

do you have any other reference to BCP ? I need some working examples rather than the explanation of every parameter.

Other thing I need to know is how can I check the current version I have installed. Before starting this thread, I had just installed SQL Server 2005 Express Edition complete (with Managment Studio, Advanced Services and Toolkit). A couple of days ago, I noticed there was a SP2 and installed it over the older one and I generated an Hybrid that didn't work, so I removed all the installations (restarted) and then installed just SQL Server 2005 Express Edition and Management Studio (nothing else yet).

THanks !

|||

Go into Add/Remove Programs, find Microsoft SQL Server 2005 and click Change. When the wizard opens, there should be a Report button, clicking this will give you a report of everything you have installed and what version it is.

Try these references for using BCP:

http://support.microsoft.com/default.aspx/kb/67409
http://www.devarticles.com/c/a/SQL-Server/An-Introduction-To-The-Bulk-Copy-Utility/

Mike

|||

Mike,

thanks for letting me know the way to check version. I'll check the BCP links now.

Before getting this answer, I tried the following (I'm a bit desperate ):

Sent all the txt files to a friend and he imported to a SLQ Server 2k database and then he sent it back to me. After that, I ran the following in my SQL Server 2005 EE :

CREATE DATABASE Bolsa ON
(FILENAME = 'u:\Bolsa de Santiago\CD Bolsa\Bolsa_Data.MDF'),
(FILENAME = 'u:\Bolsa de Santiago\CD Bolsa\Bolsa_Log.ldf')
FOR ATTACH;
GO

and got this error.

Msg 3415, Level 16, State 1, Line 1
Database 'Bolsa' cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.

Any hint on how to fix it ?

Thanks !

|||

Not sure what the U: drive is for you, if that is actually the CD drive, you will need to copy the files to a different directory since CDs are read-only. If that is not yoru CD drive, try...

Take a look at the properties of the files (right-click | Properties) to see if they are set to Read-only.

One final note, SQL Express does not support attaching files from network locations or mapped drives, they have to be on the local hard drive. Again, just wondering about that U: drive.

Mike

|||

Mike,

before posting the above, I checked the files weren't Read Only and they are not in a CD (also no network here). U: drive for me is a 4GB NTFS partition from my master HDD. Could be a problem if it's not on a FAT32 drive ? I'm running Windows XP Home Edition SP2 (spanish) and SQL Server 2005 Express Edition SP2 (english).

Bye !

|||

The KB article at http://support.microsoft.com/kb/931640 suggests that this issue is actually caused by a setting on the files created on your friends SQL 2K server. It seems like you'll need to check the properties of the database server your friend used to create the files.

It might be faster to finish down the path of figuring out your BCP issues rather than start troubleshooting a completely different problem.

Mike

|||

Hi folks,

with all deference to your knowledge, Mike, I have DTS installed on my (newish) PC and have only ever installed SQL Express with Advanced Features and the Toolkit..

Admittedly, it took some finding, but there it is at "C:\Program Files\Microsoft SQL Server\90\Binn\DTS\DTSWizard.exe".

From a pragmatic point of view, with deadlines approaching, perhaps rrudolph should try (custom) installing the Toolkit and checking out ALL the component trees?

Regards to all

Steve

|||

Hi Steve,

I'm just telling you that using that wizard in Express has not been tested, nor is it supported, so you use it at your own risk.

The amount of work in a project is the sum of the work to do it the first time and then to do it over to fix your mistakes. I find using unsupported technology is usually one of those mistakes that needs to be fixed later.

Mike

|||

Mike,

the good news are that finally made the BCP work.

I have uploaded most of the data I needed. Just missing some files that when uploading them to the database, I noticed they contained had corrupted data. Thanks a lot for your helpful tips, links and directions. (hope next time I have to deal with BCP, I have no problems).

Steve,

I'm planning, after ending this project to re-install everything from scratch and then I will try to add the Wizard you mentioned. My doubt is last Thursday I started both installation programs ("SQL Server 2005 Express Edition with Advanced Services SP2" and "Microsoft SQL Server 2005 Express Edition Toolkit SP2") but canceled them before they modify my curent config. In none of them I was able to find the Import and Export Wizard you mentioned. I opened all the branches I found in the custom setup. When you installed yours, did you use the SP2 installation files (it's fresh from February 2007) or the ones from previous release ?

Thanks a lot !

|||

Rrudolph,

glad you got BCP running ok.

I'm still running SP1. I think(?) the wizard was in the Toolkit..!

However, if you have cracked the problems with BCP you might want to stick with that - as Mike correctly points out this DTS seems to be an un-supported feature (though why it should be so is a mystery).

I'm in the fortunate position of producing small, bespoke stuff where speed/ease of development is more important to my boss than anything else so can "risk" going with DTS (which, I'll admit, works for me like a dream).

OK, this doesn't seem to be full-blown DTS from SQL2000/2005 but it's sure good enough for my requirements.

Regards

Steve

ps - if you want me to find exactly where DTS was contact me and I'll re-install on my home PC to see where everything is.

|||

Steve,

thanks a lot for the offer.

I've just modified my profile to make my email addy visible. Email me to this one.

THanks !

Import and Export Data Wizard missing in SQL Server 2005 Express Edition

After some weeks evaluating tools and platforms for developing an application, I decided to move to SQL Server 2005 Express Edition. Everything was fine till last night, when after creating my tables, I needed to populate them. I tried to find the Import and Export Data Wizard that SQL Server 7.0 and 2000 used to have, but great was my surprise when I found - in this forum - a post that said that it's not available in the Express Edition.

I'll have to move back in time (what I hate) to remember the way BCP worked. Can somebody post some examples to not start from zero ? Does anybody know a third party visual tool that can import/export data from text files to a SQL Server DB via ODBC ?

What's the reason it was not included in the EE ?

THanks !

Hi,

BCP is documented in Books Online.

SQL Express is a free product and not all features are included. In this version they removed the Import/Export wizard for a number of reasons. We're looking at alternative soluitons for a future version of SQL Express.

Mike Wachal
SQL Express team

|||

Hi,

First off, please excuse the lack of specific detail but it's been a while since I installed this feature -

there is an import/export facility in SQL Server Express edition but it's in the "Advanced Features/Services" version.

You have to do a "custom" install and the import feature is buried in one of the tree feature diagrams and is NOT selected by default.

Open all the feature trees and check out the hints for each of the features to find the one you're after - it's definitely there 'cos I've used it to import data from an Excel workbook and from Access.

Really simple to use and very effective!

Best of luck!

|||

Hi Steve,

There is no supported Import/Export functionality in any version of SQL Express. Some people have managed to get the old Import/Export wizard onto their computers, but it has not been tested and it is not supported. If you go down this path, you do so at your own risk. BCP on the other hand is tested and supported.

Mike

|||

Steve,

thanks a lot for your coment. I'll give it a try if I don't succeed with BCP. My deadline is almost over and I can't make BCP work (I'm getting some memory allocation errors whn running it).

MIke,

do you have any other reference to BCP ? I need some working examples rather than the explanation of every parameter.

Other thing I need to know is how can I check the current version I have installed. Before starting this thread, I had just installed SQL Server 2005 Express Edition complete (with Managment Studio, Advanced Services and Toolkit). A couple of days ago, I noticed there was a SP2 and installed it over the older one and I generated an Hybrid that didn't work, so I removed all the installations (restarted) and then installed just SQL Server 2005 Express Edition and Management Studio (nothing else yet).

THanks !

|||

Go into Add/Remove Programs, find Microsoft SQL Server 2005 and click Change. When the wizard opens, there should be a Report button, clicking this will give you a report of everything you have installed and what version it is.

Try these references for using BCP:

http://support.microsoft.com/default.aspx/kb/67409
http://www.devarticles.com/c/a/SQL-Server/An-Introduction-To-The-Bulk-Copy-Utility/

Mike

|||

Mike,

thanks for letting me know the way to check version. I'll check the BCP links now.

Before getting this answer, I tried the following (I'm a bit desperate ):

Sent all the txt files to a friend and he imported to a SLQ Server 2k database and then he sent it back to me. After that, I ran the following in my SQL Server 2005 EE :

CREATE DATABASE Bolsa ON
(FILENAME = 'u:\Bolsa de Santiago\CD Bolsa\Bolsa_Data.MDF'),
(FILENAME = 'u:\Bolsa de Santiago\CD Bolsa\Bolsa_Log.ldf')
FOR ATTACH;
GO

and got this error.

Msg 3415, Level 16, State 1, Line 1
Database 'Bolsa' cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.

Any hint on how to fix it ?

Thanks !

|||

Not sure what the U: drive is for you, if that is actually the CD drive, you will need to copy the files to a different directory since CDs are read-only. If that is not yoru CD drive, try...

Take a look at the properties of the files (right-click | Properties) to see if they are set to Read-only.

One final note, SQL Express does not support attaching files from network locations or mapped drives, they have to be on the local hard drive. Again, just wondering about that U: drive.

Mike

|||

Mike,

before posting the above, I checked the files weren't Read Only and they are not in a CD (also no network here). U: drive for me is a 4GB NTFS partition from my master HDD. Could be a problem if it's not on a FAT32 drive ? I'm running Windows XP Home Edition SP2 (spanish) and SQL Server 2005 Express Edition SP2 (english).

Bye !

|||

The KB article at http://support.microsoft.com/kb/931640 suggests that this issue is actually caused by a setting on the files created on your friends SQL 2K server. It seems like you'll need to check the properties of the database server your friend used to create the files.

It might be faster to finish down the path of figuring out your BCP issues rather than start troubleshooting a completely different problem.

Mike

|||

Hi folks,

with all deference to your knowledge, Mike, I have DTS installed on my (newish) PC and have only ever installed SQL Express with Advanced Features and the Toolkit..

Admittedly, it took some finding, but there it is at "C:\Program Files\Microsoft SQL Server\90\Binn\DTS\DTSWizard.exe".

From a pragmatic point of view, with deadlines approaching, perhaps rrudolph should try (custom) installing the Toolkit and checking out ALL the component trees?

Regards to all

Steve

|||

Hi Steve,

I'm just telling you that using that wizard in Express has not been tested, nor is it supported, so you use it at your own risk.

The amount of work in a project is the sum of the work to do it the first time and then to do it over to fix your mistakes. I find using unsupported technology is usually one of those mistakes that needs to be fixed later.

Mike

|||

Mike,

the good news are that finally made the BCP work.

I have uploaded most of the data I needed. Just missing some files that when uploading them to the database, I noticed they contained had corrupted data. Thanks a lot for your helpful tips, links and directions. (hope next time I have to deal with BCP, I have no problems).

Steve,

I'm planning, after ending this project to re-install everything from scratch and then I will try to add the Wizard you mentioned. My doubt is last Thursday I started both installation programs ("SQL Server 2005 Express Edition with Advanced Services SP2" and "Microsoft SQL Server 2005 Express Edition Toolkit SP2") but canceled them before they modify my curent config. In none of them I was able to find the Import and Export Wizard you mentioned. I opened all the branches I found in the custom setup. When you installed yours, did you use the SP2 installation files (it's fresh from February 2007) or the ones from previous release ?

Thanks a lot !

|||

Rrudolph,

glad you got BCP running ok.

I'm still running SP1. I think(?) the wizard was in the Toolkit..!

However, if you have cracked the problems with BCP you might want to stick with that - as Mike correctly points out this DTS seems to be an un-supported feature (though why it should be so is a mystery).

I'm in the fortunate position of producing small, bespoke stuff where speed/ease of development is more important to my boss than anything else so can "risk" going with DTS (which, I'll admit, works for me like a dream).

OK, this doesn't seem to be full-blown DTS from SQL2000/2005 but it's sure good enough for my requirements.

Regards

Steve

ps - if you want me to find exactly where DTS was contact me and I'll re-install on my home PC to see where everything is.

|||

Steve,

thanks a lot for the offer.

I've just modified my profile to make my email addy visible. Email me to this one.

THanks !

Friday, February 24, 2012

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

Sunday, February 19, 2012

Import / Export Data - GUI

Hi,

I am trying Express Edition 2005 but could not found GUI init, can someone advsie that which SQL Server 2005 provides GUI and which one is more friendly to import/export data- thanks

AA

SQL Server Express does not install a GUI client tool. To obtain SQL Server Management Studio Express (SSMSE), download from here:

SQL Server 2005 Express Edition Client Tools
http://tinyurl.com/yelwr9 (SSMSE)

SQL Server 2005 SSMS Express Tutorial
http://tinyurl.com/nqsca

There is NOT a GUI for data import/export included with SQL Express. However, you can use the DTSWizard for some operations. Using Explorer, search for DTSWizard.exe. Most likely located in {InstallLocation}\Microsoft SQL Server\90\DTS\Binn