Tag: file

Downloading a file after storing it in SQL Server 2008 Data Base

WEB FRAMEWORK: ASP.NET in C# Hey guys, I’ve looked all over the web for something that would show me how to do this but can’t find it. I have a page that uploads information about an individual including a resume in the form of a doc docx or pdf. I can upload the file okay […]

Have Sql SMO Delete Database Backup File

I have create a C# application that allows a database to be backed up and restored. It does this by first backing the database up to a local file on the Sql server using: Backup backup = new Backup(); backup.Devices.AddDevice(Path.GetFullPath(backupFilePath), DeviceType.File); … backup.SqlBackup(server); And then I create the new database by restoring from the backup […]

SQL Server read csv binary from table

I currently store my csv formatted files on disk and then query them like this: SELECT * FROM OPENROWSET(BULK ‘C:\myfile.csv’, FORMATFILE = ‘C\format.fmt’, FIRSTROW = 2) AS rs Where format.fmt are the defined format of the columns in the csv file. This works very well. But I’m interested in storing the file in a SQL […]

SQL Server 2008 File Write Behaviors

Sort of a 101 question: with multiple files in a user defined filegroup, what is SQL Servers behavior when inserting rows? Round robin? Write until full and move on to the next? I have found some interesting posts regarding tempDb on this subject that suggest round robin, but nothing conclusive.

What are the different possibilities to store a large number of files in a SQL Server 2008 Database?

Let’s say i want to build a website that will hold a very large number (at least 10 millions) of small files (around 50KB, mostly PDF, but also word/excel documents, jpg, and text files). Using SQL Server 2008 database, what are the different technical possibilities to store these files (eg: using a table with for […]

How third-party SQL Server backup tools access databases' files for backup?

I’m reading about Red Gate SQL Backup, and I liked the concept of creating a database backup compressed and writing on disk the compressed backup directly without an intermediate SQL Server native backup. And I’m wondering how this type of software make backups. It accesses the database files directly? It uses some sort of SQL […]

How to write a file to disk and insert a database record in a single transaction?

I am trying to write a file to disk as well as insert data into a database via a stored procedure all within an atomic transaction. i.e. If any one of these 2 operations fails (either the file cannot be written to disk or the stored procedure fails) I’d like to do nothing and simply […]

SQL Server BCP export corrupted file?

i have a small problem with BCP functionality in SQL Server 2012. The things is: im loading .jpg image (167KB in size) using below command: INSERT [tabela_testowa] ( Data ) SELECT * FROM OPENROWSET (BULK N’C:\foty\ch6_MagicShop.jpg’, SINGLE_BLOB) a; and then im trying to export it back to disk using: BCP “SELECT data FROM tabela_testowa WHERE […]

What is an MDF file?

Is this like an “embedded” database of sorts? A file containing a built in database?

How to export data as CSV format from SQL Server using sqlcmd?

I can quite easily dump data into a text file such as: sqlcmd -S myServer -d myDB -E -Q “select col1, col2, col3 from SomeTable” -o “MyData.txt” However, I have looked at the help files for SQLCMD but have not seen an option specifically for CSV. Is there a way to dump data from a […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.