While working to develop a SIKULI script to run on multiple machines, i came to a situation to attach a database in every machine. As sikuli is not much flexible, i choose to attach the db via T-SQL .
I opened the SQL server management studio in the remote machine and logged into that with SIKULI script. so finally find the below code to be run on a new query window.
CREATE DATABASE RAPOS_Replication
ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication.mdf'),
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication_Log.ldf')
FOR ATTACH;
With sikuli, its some thing like below:
type('CREATE DATABASE RAPOS_Replication')
type(' ON (FILENAME = \'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication.mdf\'),')
type(' (FILENAME = \'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication_Log.ldf\')')
type('FOR ATTACH;'+Key.ENTER+Key.F5)
wait(3)
I opened the SQL server management studio in the remote machine and logged into that with SIKULI script. so finally find the below code to be run on a new query window.
CREATE DATABASE RAPOS_Replication
ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication.mdf'),
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication_Log.ldf')
FOR ATTACH;
With sikuli, its some thing like below:
type('CREATE DATABASE RAPOS_Replication')
type(' ON (FILENAME = \'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication.mdf\'),')
type(' (FILENAME = \'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication_Log.ldf\')')
type('FOR ATTACH;'+Key.ENTER+Key.F5)
wait(3)
No comments:
Post a Comment