SQL Server .bak (1 Viewer)

zezo2021

Member
Local time
Today, 13:17
Joined
Mar 25, 2021
Messages
381
Is there any way to import a bak file to access DB


without any application like SQL Server or SQL Server management studio

Thank you so much in advance
 

tvanstiphout

Active member
Local time
Today, 04:17
Joined
Jan 22, 2016
Messages
222
Not unless you go to extremes, like parsing that file format yourself.
 

zezo2021

Member
Local time
Today, 13:17
Joined
Mar 25, 2021
Messages
381
I found this code but need a connection to SQL server

I don't want to use SQL SEVER

Code:
Sub ImportSQLServerBAK()



'Declare variables

Dim strSQLServerConnStr As String

Dim strSQLServerBAKFilePath As String

Dim strAccessDBPath As String



'Enter the SQL Server connection string

strSQLServerConnStr = "Server=localhost;Database=master;Integrated Security=True"



'Enter the path to the SQL Server BAK file

strSQLServerBAKFilePath = "e:\AdventureWorksLT2012.bak"



'Enter the path to the Access database

strAccessDBPath = "e:\database4.accdb"



'Create a new ADO connection object

Dim cnn As New ADODB.Connection

cnn.Open strSQLServerConnStr



'Create a new ADO command object

Dim cmd As New ADODB.Command

cmd.ActiveConnection = cnn



'Create the SQL statement to restore the database

Dim strRestoreSQL As String

strRestoreSQL = "RESTORE DATABASE [DatabaseName] FROM DISK = '" & strSQLServerBAKFilePath & "'"



'Execute the SQL statement

cmd.CommandText = strRestoreSQL

cmd.Execute



'Close the ADO connection object

cnn.Close



End Sub
 

tvanstiphout

Active member
Local time
Today, 04:17
Joined
Jan 22, 2016
Messages
222
Then this code is not going to help you. As I said in first instance.
 

tvanstiphout

Active member
Local time
Today, 04:17
Joined
Jan 22, 2016
Messages
222
> I don't want to use SQL SERVER
What EXACTLY do you mean by that? What do you object to? Maybe we can make a suggestion.
For example if you said "too expensive" we would point to a free version.
If you said "no disk space" we would point to SQL Server Azure online service.
Etc.
 

zezo2021

Member
Local time
Today, 13:17
Joined
Mar 25, 2021
Messages
381
1- Installing SQL server slows my computer

2- I tried opening bak with sqllite but not work also

3- I don't complex solution SQL sever , azure etc (Handy solution)

Thanks
 

tvanstiphout

Active member
Local time
Today, 04:17
Joined
Jan 22, 2016
Messages
222
SQL Server can be a memory hog. The free Express Edition less so.
Of course you can stop the SQL Server services when you're not using the app, then they are not running and don't take up any memory or cpu. You can write a small batch file to start and stop the services (search online for "net start batch file").

If this is not an option for you, then the next step would be to ask the data provider to give you the data in another format such as ACCDB or XLSX or CSV.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:17
Joined
Feb 19, 2002
Messages
43,293
It is easy enough to transfer data from SQL Server to Access but NOT USING THIS METHOD. If all you have is a .bak file then your only option is to load the .bak using SQL Server and then use some other method to extract it. A simple no code method is to create an empty Access database Then using External Data import from SQL Server to Access. There are other methods also but it depends on what tools you have available and what is the source for the data.
 
Last edited:

Galaxiom

Super Moderator
Staff member
Local time
Today, 21:17
Joined
Jan 20, 2009
Messages
12,852
SQL Server can be a memory hog.
There is a setting for the maximum memory set aside for SQL Server.

I think it still uses any unallocated memory to cache records used in queries but will relinquish that memory when required for other applications.
 

Users who are viewing this thread

Top Bottom