My random rumblings

Something of everything and nothing at all

SQL Server Table Export and Import

The data of a table in SQL Server can be exported using the following command

C:\>bcp "<db name>.<schema>.<table_name>" out "d:\roadinfo.bin" -T -n -S .

A query can also be used by changing out to outquery.

Ensure that the destination table on the destination database has the same layout.

C:\>bcp "<db name>.<schema>.<table_name>" in "d:\roadinfo.bin" -n -S <server_name> -U <username> -P <password>

 

How to change path to executable to a service

Copied from superuser.com:

 

You can use the sc config command to change the path a service points to.

C:\>sc config YourServiceName binPath= "C:\SomeDirectory\YourFile.EXE"

This will update the service called YourServiceName and change the "Path to Executable" entry to C:\SomeDirectory\YourFile.EXE. You will want to restart your service afterwards, which you can do with:

C:\>net stop YourServiceName

C:\>net start YourServiceName

 

Note there is a required space between binpath= and the command

Data Analytics

If you torture the data long enough, it will confess.

  • Ronald Coase, Professor of Economics, Chicago

Science

The most exciting and phrase to hear in science, the one that heralds new discoveries, is not "Eureka!" but rather "Hmm… that's funny…"

  • Isaac Asimov