0

I tried using blob:

INSERT INTO [dbo].[ProbaImage](Id, Podatak) 
    SELECT 
        1,* 
    FROM 
        OPENROWSET(BULK N'C:\Users\Desktop\AUTOTROLEJ.sdf', SINGLE_BLOB) AS Podatak
GO

But it doesn't work, it gives me the error that cannot read this file. I find out about file tables into SQL Server 2012, but I don't know how to use them.

Can someone suggest me a method to insert this .sdf file?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user1788654
  • 311
  • 2
  • 5
  • 13
  • Do you want to insert the whole `.sdf` file as a blob, or do you want to extract the data from that file (which is a SQL Server Compact Edition database file) and store that relational data in SQL Server? – marc_s Feb 13 '13 at 13:39
  • 1
    If you want to insert the file into your server database, the file you're reading **must be** on the server machine's disk system. So if you have a separate server - you need to copy the `.sdf` file to that server machine's filesystem first - you cannot load into a remote server's database table from your local PC harddisk... – marc_s Feb 13 '13 at 13:40
  • i need the whole .sdf file not the data from that file. I get it for the server machine's disk, maybe this was the problem. thank you. I will try. And the file table is a good alternative? – user1788654 Feb 13 '13 at 14:13
  • @marc_s is there any other way to do that, without coping the file on the server machine's filesystem? – user1788654 Feb 13 '13 at 14:24
  • You could create a fileshare on your local PC that's accessible from the SQL Server machine. Either that, or copy the file to the server . – marc_s Feb 13 '13 at 14:53

0 Answers0