Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4080504
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:56:19+00:00 2026-05-20T17:56:19+00:00

I was contemplating the creation of a tool to load varbinary(max) fields in a

  • 0

I was contemplating the creation of a tool to load varbinary(max) fields in a SQL Server 2008 database with files as selected from a open file dialog. Is there any such tool or equivalent that I could use? My SQL server is in a hosted environment where I don’t have physical access to the server so loading it with TSQL is not an option.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:56:20+00:00Added an answer on May 20, 2026 at 5:56 pm

    How about powershell?

    # from: http://sev17.com/2010/05/t-sql-tuesday-006-blobs-filestream-and-powershell/
    #
    $server = "superfly\sqlexpress"
    $database = "Yak"
    $query = "INSERT dbo.FileStore VALUES (@FileData, @FileName)"
    $filepath = "d:\yak.txt"
    $FileName = get-childitem $filepath | select -ExpandProperty Name
    
    $connection=new-object System.Data.SqlClient.SQLConnection
    $connection.ConnectionString="Server={0};Database={1};Integrated Security=True" -f $server,$database
    $command=new-object system.Data.SqlClient.SqlCommand($query,$connection)
    $command.CommandTimeout=120
    $connection.Open()
    
    $fs = new-object System.IO.FileStream($filePath,[System.IO.FileMode]'Open',[System.IO.FileAccess]'Read')
    $buffer = new-object byte[] -ArgumentList $fs.Length
    $fs.Read($buffer, 0, $buffer.Length)
    $fs.Close()
    
    $command.Parameters.Add("@FileData", [System.Data.SqlDbType]"VarBinary", $buffer.Length)
    $command.Parameters["@FileData"].Value = $buffer
    $command.Parameters.Add("@FileName", [System.Data.SqlDbType]"NChar", 50)
    $command.Parameters["@FileName"].Value = $FileName
    $command.ExecuteNonQuery()
    
    $connection.Close()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm contemplating a multi tenant application - shared database, shared schema. A tenant identifier
I am contemplating the creation of an OSX System Service as outlined here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/SysServices/introduction.html
While contemplating this question about a SQL INSERT statement, it occurred to me that
We are contemplating using the DataGrid component from DojoX in our web applications. The
I've been contemplating how to protect my C/C++ code from disassembly and reverse engineering.
We're contemplating Visual Studio licensing and need to decide whether licenses for Architecture/Database/Test editions
I've been contemplating programming language designs, and from the definition of Declarative Programming on
I am contemplating a jump into the Git bandwagon. My environment is made from
I was contemplating switching to Linux for C++ development, coming from a Windows environment.
I am contemplating a switch from MySQL to PostgreSQL. What are your tips, tricks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.