SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Import/Export files (.txt/.csv/.xls) into SQL 2005 Compact Edition


Import/Export files (.txt/.csv/.xls) into SQL 2005 Compact Edition

Author
Message
balasach82
balasach82
SSC Eights!
SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)

Group: General Forum Members
Points: 819 Visits: 1080
I have an SDF file. I need to import some new data into a new table in that SDF. The data could be a .TXT/.csv/.xls.. What are the ways available to do the import/export into SQL 2005 CE?

Also, how to query an table in SDF from an SQL 2005 Enterprise edition?
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)

Group: General Forum Members
Points: 85374 Visits: 41078
Pardon my ignorance. What's an "SDF"?

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
balasach82
balasach82
SSC Eights!
SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)SSC Eights! (819 reputation)

Group: General Forum Members
Points: 819 Visits: 1080
Jeff,

yes, it was an revelation to me. I didnt knew abt this.

From MSDN:

"A SQL Server Compact Edition database is stored in a file with the .sdf extension"

http://msdn.microsoft.com/en-us/library/ms171986(v=SQL.90).aspx
Lowell
Lowell
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28072 Visits: 39926
Jeff Moden (4/23/2011)
Pardon my ignorance. What's an "SDF"?


SQL Server Compact Edition databases are supposed to a good idea for mobile phones and other portable devices;There's no service like SQLServer needed to run against them, it's kind of like an access database in that regard.

I think the target audience is actually Laptops that need to sync with a master database on an intermittent basis, because you can make push/pull replication subscriptions to them. You know, the typical, in the field issues where they need access to database stuff, add invoices, and sync later.

At least for smaller devices/ mobile development, The problem is that it requires the compact .NET framework, which in turn requires the Windows mobile operating system.

Since that's not as popular as say, the Android OS, your future markets a little more limited; I ended up using SQLite database instead, as there's more code examples for using that, and can be used with or without the Windows OS on those portables, as well as in full windows Operating systems.

Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

David Burrows
David Burrows
SSCrazy Eights
SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)

Group: General Forum Members
Points: 9538 Visits: 9743
Jeff Moden (4/23/2011)
Pardon my ignorance. What's an "SDF"?

Crikey Jeff, I'm agog with amazement Hehe
You being a SQL god an 'all :-)
I guess DBA's don't venture out of the sandbox after all :-P


Far away is close at hand in the images of elsewhere.

Anon.


Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)

Group: General Forum Members
Points: 85374 Visits: 41078
David Burrows (4/24/2011)
Jeff Moden (4/23/2011)
Pardon my ignorance. What's an "SDF"?

Crikey Jeff, I'm agog with amazement Hehe
You being a SQL god an 'all :-)
I guess DBA's don't venture out of the sandbox after all :-P


BWAA-HAAA!!!! I don't consider CE to be SQL in any way, shape, or form. In fact, I'm sure the abbreviation of "CE" actually stands for "Crippled Edition" or "Cruddy Example" or "Crap/Excrement". It's nothing more than a data dumping ground for the very things people have mentioned. It can't use stored procedures, functions, views, or even variables. The best it can do is be interfaced with a front end using 100% embedded code. Sure, it'll run some pretty limited SQL scripts. After I found out what it was for, I never looked at it again. Certainly not long enough to be made familiar with the file extensions it uses. :-P

My closest contact with CE was when my boss asked me to convert some rather sophisticated T-SQL to CE. After studying about its limitations, I told my boss that he really needs to hire a good front end developer that can read T-SQL well enough to write objects and procs in the "C" family of code from it because there was simply no way possible to migrate T-SQL to CE.

Does CE do what it was designed to do? Absolutely. And that's precisely why I don't use it nor do I study it. :-) It's apparently MicroSoft's answer to about the closest you can get to a NO SQL product without actually being one.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)

Group: General Forum Members
Points: 85374 Visits: 41078
Ok... I got all of my griping out of the way :-D. Does anyone have an answer for balasach82 question about how to import txt/csv/xls data into CE because I sure don't know. I'm thinking the front end code would need to do that.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
David Burrows
David Burrows
SSCrazy Eights
SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)

Group: General Forum Members
Points: 9538 Visits: 9743
Nice riposte Jeff :-)
I consider myself remonstrated Crying

My only dabble with SDF was on a scanner with an older version of CE to SQL2K via Web Service. I believe the newer versions allow better access to SQL Server but I could be wrong. I will check with one of my colleagues who has worked on this sort of thing when I get back to the shop tomorrow.


Far away is close at hand in the images of elsewhere.

Anon.


Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)

Group: General Forum Members
Points: 85374 Visits: 41078
Gah!... I didn't mean to turn it into a rant. Sorry. The only real advantage that CE has compared to custom code might be it's ability to sort and join so you don't have to write that stuff into a custom file handler.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
John Tower
John Tower
Valued Member
Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)

Group: General Forum Members
Points: 55 Visits: 118
You can connect to a CE database using the Server Management Studio (choose CE from the Server Type dropdown) and then you will have to browse to the directory containing the sdf file. I believe you can import/export data from there.

A program could also be written to do imports and exports.

John
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search