mysqldump equivalent in SQL Server

This is frustrating for a mysql user to take a database dump when they try to do the same in sql server. Here is the one of the optimal way for a mysql user working for sql server.

Right Click on database -> Tasks -> Generate Scripts..
Next -> Select the database name from a list
Under advanced scripting option-> Types of data to Script
You have 3 options to be selected here

  1. Schema only
  2. Data only
  3. Schema and data

sqldump
Later on give the path and file name for generating the script.

Now question is how to run this script?

Two ways:
1. run the below command at DOS command prompt

OSQL -U <userName> -P <password> -S <serverName> -i  <completepathSQLFile>

OR
2. Open the generated script file in a query window and just run them in one go. Just like you run a simple query. But you are advised to do provided its a small sized file.

Advertisements

Live Situation #4: Explore long path folder with just one click

Working either with Biztalk or Mirth, you are required to remember the path for dropping a file to receive port(location) or viewing the output file to send port. You get frustrated every time to browse such a long path.
This utility will allow you to browse such folders using just single click.

Here is the damn shortcut using DOS command in a batch file.
START” command runs the service into a separate window.
In the code below, define all your receive folders under Option sections dedicating them to specific numbers.

Save this file in your desktop using .bat extension. Just double click on the batch file. Rest will guide you automatically.


@ECHO OFF

:menuLOOP
echo.================== Menu ==================
echo. 1. App1 DropBox  2. App2 DropBox  0. Clear Screen
set myChoice=
echo.&set /p myChoice=Enter a choice number or press ENTER to quit: || GOTO:EOF
echo.&call:Option_%myChoice%
GOTO:menuLOOP

:Option_1   Open App1 DropBox
START C://MyApp1/
cls
GOTO:EOF

:Option_2   Open App2 DropBox
START C://MyApp2/
cls
GOTO:EOF

:Option_0   Clear Screen
cls
GOTO:EOF

Sleep method in Mirth

There are situations where in you will configure your source connector as “Database Reader”.
Assuming you define a polling frequency of 10seconds.

Now at the source transformer level, you write several lines of java script code to interact further with data values fetched from the query defined at source connector level.
This may crash the Database server, as the polling frequency is pretty less and it fires the query immediately because you have defined them at the connector level.

You can save yourself in many ways, but I feel this sounds more suitable to implement a delay as the very first transformer (Step 1 among all your steps).

Below is the java script code; can be embedded into any source transformer in Mirth.

function dummySleep(delay)
{
//channelMap.put("Beforetime", new Date().getTime().toString());
var start = new Date().getTime();
while (new Date().getTime() < start + delay);
//channelMap.put("aftertime", new Date().getTime().toString());
}