Archive for October, 2008

c# :: prefix versus postfix increment

I remember the pre and post incrementing function in C++ and Java but yesterday I got a bit of a refresher. So I’ve decided to put it on my blog in case other noobs out there is also looking for the answer. The screenshot pretty much explain it all.

Friday, October 31st, 2008

finding foreign keys

When you are attempting to drop an index on a table, you are given the following error:
An explicit DROP INDEX is not allowed on index ‘db.tbl_name.index_name’. It is being used for UNIQUE KEY constraint enforcement.
This normally means that the index on the table you are trying to modified is being referenced by another table somewhere [...]

Thursday, October 30th, 2008

general network error

The 16 new servers I am working on is getting a lot of these errors:
[Microsoft][ODBC SQL Server Driver][DBNETLIB] General Network error. Check your network documentation
ERROR [08S01] [Microsoft][SQL Native Client]Communication link failure
System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed [...]

Thursday, October 23rd, 2008

writing WHILE loop with 2 conditions

Thru out the day, I was just hammering out WHILE loops left and right. Everything was going smoothly when looping thru using 1 condition. Cake walk. Then later in the day, I tried to throw in 2 conditions and disaster struck. The damn script never made it into the WHILE loop. [...]

Thursday, October 23rd, 2008

semaphore timeout period has expired

Yesterday, I was deploying some scripts to production. One of the script was to create a database and set its intial size to 50GB for data and log. It created the database alright on the local server but when it attempts to create it on remote servers, it failed with the following error [...]

Tuesday, October 21st, 2008

SQL 2008 Inserts

Remember back in 2000 and 2005 or even older versions, when you were trying to insert multiple rows into a single table? Your code would look something like this
insert into [table_name] (column_1, column_2)
values (’1′,’2′)
insert into
(column_1, column_2)
values (’3′,’4′)
insert into
(column_1, column_2)
values (’5′,’6′)
or
insert into [table_name] (column_1, column_2)
select ‘1′,’2′
union all
select ‘3′,’4′
union all
select [...]

Wednesday, October 8th, 2008

Replication :: Check for Replication Errors

Don’t you hate it when you are the last one to know about any type of replication error(s)? I mean, you are the bloody DBA for crying out loud. Shouldn’t you be on top of the game?
The attached script will alert you when there are any errors in replication in the last 5 [...]

Tuesday, October 7th, 2008

C# :: static void Main()

As I’m reading my Essential C# 3.0 book, it was going over the null and void thing. I understand how null works because I use it a lot in SQL, but void is kind of new to me.
Back in high school, I did some C++ stuff and managed to write a hangman program that [...]

Tuesday, October 7th, 2008

Learning C#

So I’ve decided I want to learn some C# and write some hacks in order to take over the world!!! hahaha no. My noob skills in this arena wouldn’t even come close to making a dent.
With SQL 2000 and 2005, all the documentation you’ll ever need is in the Book Online. After [...]

Monday, October 6th, 2008

Getting a percentage

An annoying friend of mine and I was talking about percentage gain in stocks. I was damn good at math when I was in middle school but once I got to high school, I could care less. I take classes like Algebra, Geometry, Calculus and Trig. I passed them with either a [...]

Friday, October 3rd, 2008