Mssql-docker: Databases not attached

Created on 1 Nov 2017  路  3Comments  路  Source: microsoft/mssql-docker

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']}]"

Most helpful comment

It took 4 slashes to make this work for me

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

All 3 comments

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

It took 4 slashes to make this work for me

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

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

Was this page helpful?
0 / 5 - 0 ratings