Category Archives: Uncategorized

Using Powershell to delete lines from a text file based on certain keywords

In continuation with the previous post, there was an issue that was encountered in a certain text file. There was a lot of redundant data in the output file. Let’s say like this : “Error 11111 : The check finished … Continue reading

Posted in Uncategorized | Leave a comment

Using Powershell to run scripts against multiple servers

Recently I started digging up Powershell. I am amazed at how elegant and powerful it is, not to mention it’s speed ! To start, I browsed to Start > All Programs > Accessories > Windows Powershell > Windows Powershell where we … Continue reading

Posted in Uncategorized | Leave a comment

Importing data from Oracle database to SQL Server using SSIS

Let’s say we have a couple of tables in Oracle that need to be imported to SQL Server. Note that only certain tables need to be imported, and not the entire schema (packages, functions, etc). One of the easiest ways … Continue reading

Posted in Uncategorized | Leave a comment

Using “WITH VALUES” in a DEFAULT clause

The WITH VALUES clause is simple to understand. Suppose we have a table called Orders  : Now we add a column with a default value : alter table orders add newcol varchar(100) default 10 insert orders (orderid,orderdate,custid) values (101,getdate(),1) Now … Continue reading

Posted in Uncategorized | Leave a comment

Primary Database xxx has active log shipping secondary database(s). Drop the secondary database(s) first.

Ran into a bit of a glitch with Log Shipping today. As you know, there are three simple documented steps to remove log shipping from your server: Remove log shipping on primary using : EXEC master.dbo.sp_delete_log_shipping_primary_secondary Remove log shipping on … Continue reading

Posted in Uncategorized | Leave a comment

SQL Server Export/Import Wizard and the missing Identity property (Or : How I learnt not to trust the Wizard)

SQL Server comes equipped with a fantastic wizard for importing/exporting data. It’s so simple : just right click on your database > Tasks > Export Data (or Import Data). What could be simpler, right ? No, sir, this is one … Continue reading

Posted in Uncategorized | Leave a comment

Of Profiler, Deadlock Graphs and XDLs

SQL Server Profiler is deprecated in favour of the more versatile Extended Events, but it still is a mighty useful tool to have. You can save the Deadlock graphs separately (as .XDL files) when setting up Profiler. Once you select … Continue reading

Posted in Uncategorized | Leave a comment