How to convert Nvarchar column to INT

CONVERT takes the column name, not a string containing the column name; your current expression tries to convert the string A.my_NvarcharColumn to an integer instead of the column content. SELECT convert (int, N’A.my_NvarcharColumn’) FROM A; should instead be SELECT convert (int, A.my_NvarcharColumn) FROM A; Simple SQLfiddle here.

Docker + mssql-server-linux: How to launch .sql file during build (from Dockerfile)

I ended up using a slightly modified version of VDR’s solution which waits for the sqlservr to start by checking the logs instead of sleeping 10 seconds: RUN ( /opt/mssql/bin/sqlservr –accept-eula & ) | grep -q “Service Broker manager has started” \ && /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P ‘P@ssw0rd’ -i /opt/mssql-scripts/000_create_db.sql \ && pkill … Read more

How can I copy data records between two instances of an SQLServer database

If your production SQL server and test SQL server can talk, you could just do in with a SQL insert statement. first run the following on your test server: Execute sp_addlinkedserver PRODUCTION_SERVER_NAME Then just create the insert statement: INSERT INTO [PRODUCTION_SERVER_NAME].DATABASE_NAME.dbo.TABLE_NAME (Names_of_Columns_to_be_inserted) SELECT Names_of_Columns_to_be_inserted FROM TABLE_NAME