mssql-docker icon indicating copy to clipboard operation
mssql-docker copied to clipboard

Databases not attached

Open andyjansson opened this issue 9 years ago • 3 comments

output:

sql_1    | VERBOSE: Starting SQL Server
sql_1    | VERBOSE: Changing SA login credentials
sql_1    | VERBOSE: Attaching 104 database(s)
sql_1    | VERBOSE: Invoke-Sqlcmd -Query IF EXISTS (SELECT 1 FROM SYS.DATABASES WHERE NAME
sql_1    |  = '') BEGIN EXEC sp_detach_db [] END;CREATE DATABASE [] ON  FOR ATTACH;
sql_1    | Msg 1038, Level 15, State 4, Server AA70365A420D, Line 1
sql_1    | An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.
sql_1    | Msg 1038, Level 15, State 4, Server AA70365A420D, Line 1
sql_1    | An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.
sql_1    | Msg 156, Level 15, State 1, Server AA70365A420D, Line 1
sql_1    | Incorrect syntax near the keyword 'FOR'.

sql_1    | VERBOSE: Started SQL Server.

docker-compose.yml:

version: '3'
services:
  sql:
    image: "microsoft/mssql-server-windows-developer"
    env_file: sql.env
    volumes:
      - ./sql/dbs/:C:/temp/
    ports: 
      - "1433:1433"

configuration from sql.env:

attach_dbs="[{'dbName':'foo','dbFiles':['C:\\temp\\foo.mdf','C:\\temp\\foo.ldf']}]"

andyjansson avatar Nov 01 '17 08:11 andyjansson

Yes Same problem for me. I tried switching C:\temp\foo.mdf => C:\temp\foo.mdf and tried C:/temp/foo.mdf nothing is working for me.

pradley avatar Nov 06 '17 21:11 pradley

It took 4 slashes to make this work for me

attach_dbs="[{'dbName':'foo','dbFiles':['C:\\\\temp\\\\foo.mdf','C:\\\\temp\\\\foo.ldf']}]"

dbelcham avatar Dec 12 '17 19:12 dbelcham

Yooo dbelcham that worked for me dude !! TY ALOT !!!

pradley avatar Dec 22 '17 18:12 pradley