Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
123sqlteam
Starting Member
4 Posts |
Posted - 2011-08-18 : 14:54:52
|
MSDN states Creating a Data FileThe following example shows how to use INSERT to create a file that contains data. The Database Engine converts the string Seismic Data to a varbinary(max) value. FILESTREAM creates the Windows file if it does not already exist.The data is then added to the data file.FileStream is enabled and tested. Have $FSLOG and filestream.hdr.Inserts work fine for the filestream enabled table. re: http://www.sqlskills.com/blogs/paul/category/filestream.aspxINSERT INTO FileStreamTest1 VALUES ( NEWID (), 'Paul Randal', CAST ('SQLskills.com' AS VARBINARY(MAX)));GO I should see a new folder with guid name in which my binary blob is sitting. Blob file never gets created and I have no errors, event logs, everyone ACL/modify on this folder. What am I missing. A collegue suggested using c# to achive this,1 - get file path from sproc after insertion and write to ntfs... code omitted ... SqlParameter SqlParamOutput = new SqlParameter("@filepath", System.Data.SqlDbType.VarChar, -1); SqlParamOutput.Direction = System.Data.ParameterDirection.Output; SqlCmd.Parameters.Add(SqlParam2); SqlCmd.Parameters.Add(SqlParam1); SqlCmd.Parameters.Add(SqlParamOutput); SqlCmd.ExecuteNonQuery(); string Path = SqlCmd.Parameters["@filepath"].Value.ToString(); SqlCmd = new SqlCommand("SELECT GET_FILESTREAM_TRANSACTION_CONTEXT()", SqlCon, SqlTran); byte[] objContext = (byte[])SqlCmd.ExecuteScalar(); System.Data.SqlTypes.SqlFileStream SqlFileStream = new System.Data.SqlTypes.SqlFileStream(Path, objContext, System.IO.FileAccess.Write); SqlFileStream.Write(buffer, 0, buffer.Length); SqlFileStream.Close();This seems to defeat the purpose of filestream. Thanks. |
|
123sqlteam
Starting Member
4 Posts |
|
|
|
|
|
|