hi, a peer of mine would like to be self sufficient in bringing small .bak's over to her local without rdp'ing to the sql server or mapping a drive to that server or asking our dba for help.
I dont even think she would mind if sql sent the .bak straight across the wire to her c: drive.
is there a way running ssms locally but connected to a remote sql server to direct the .bak to a local folder? i usually run this command when i'm backing up to another server's z:drive.
BACKUP DATABASE [xx] TO DISK = N'Z:\Backup\xx.bak' WITH NOFORMAT, NOINIT, NAME = N'DW-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
January 30, 2026 at 8:23 pm
I don't think there's a way to do this in t-sql. When you connect with SSMS, you're accessing the server and getting results streaming in text. I suppose some sort of sqlcmd, query with xp_cmdshell to stream the contents of the .bak file back as binary to a file on your system, but it might be flaky.
file sync is common. You'd be better off doing something simple like a OneDrive/DropBox/Box/etc. to sync the backups to the cloud and pull them down.
Or a script that copies specific files to a sync place, that you can then delete when you have them
you can backup the db to a UNC share - so if she has permissions to do backups, permissions to share a drive with the SQL Server account then she can do it.
another possible way, which i've never tried, is to use openrowset to read the .bak file to a table on the server, then download the content (in binary mode) to a file locally.
drop table if exists dbo.backupfile
create table dbo.backupfile
(data varbinary(max)
)
insert into dbo.backupfile
SELECT * FROM OPENROWSET( BULK N'C:\dbname.bak', SINGLE_BLOB ) AS Document;
the contents of the table (single row) can then be written to a local file in binary mode using several tools (powershell, C#, SSIS and others)
I trust that she has permission to copy a database to a local pc, and that the data is not sensitive.
January 30, 2026 at 10:17 pm
i wonder if making that table a temp would get us past any permissions issues we'd have otherwise. now that i look at it closer i dont understand. how does sql know what db to use a s a source? i think you are saying the source is a .bak. and then various etl tools can be used to copy that to a local folder.
January 30, 2026 at 10:51 pm
go read the manuals. your comment shows a lack of understanding of what the openrowset command is so you need to study it
February 2, 2026 at 2:45 pm
i think we get it frederico. thx.
i think you are saying the source is a .bak. and then various etl tools can be used to copy that to a local folder.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply