November 2007 Blog Posts
If you're a .Net developer aliases should be very familiar to you. if they're not here is a reminder:using MyAlias = This.Is.My.Full.Namespace.MyClass;
MyAlias m = new MyAlias(); // MyAlias is of course of type MyClass
Well it seems SQL Server 2005 added a similar functionality to T-SQL. It's called Synonyms.
You can use them in all CRUD operations as well as in sub-selects and dynamic SQL
What's interesting is that synonyms are evaluated at run time and the binding between the synonym and an object is by name only.
This means that you can drop the object referenced by the synonym at any time, but...
Update: New Stuff from the latest update will be in RED. This list will grow as I find new tools. So if you know of some not on this list do post them in the comments. SQL Server Management Studio Add-in's SSMS Tools Pack - an add-in with lots of IDE options (Query Execution history, regions, debug sections, CRUD stored procedures creation, new query templates, running custom scripts from Object explorer's context menu) for SQL Server Management Studio and SQL Server Management Studio Express Data Scripter - generates insert statements for a table Create Database Snapshot - simple GUI...
Today I feel a bit evil minded so I thought I'd share this little prank-friendly function.
If you put this into a .Net Assembly you import to SQL Server as a function or a stored procedure
you can wreck some real havoc :)
private static void SQLPrank()
Random r1 = new Random(DateTime.Now.Millisecond);
int lowerBound = r1.Next(1000, 2000);
int upperBound = r1.Next(3000, 4000);
int randomNumber = r1.Next(1000, 4000);
1000 2000 ...
If you've ever worked with SQL Server profiler then you're familiar with the EventClass column in the trace.
It tells you what event is being monitored for each row. When you save this trace to a table you can see
that the EventClass no longer has a description but an ID. So how do you map this to a description?
If you know where to look it's amazingly simple but if you don't here's a hint: sys.trace_events
Here's a script to help you out:
SELECT TE.name, T.*
FROM dbo.Trace T -- table that contains...
We're having a contest over at SqlTeam.com. Go take a look it might be worth your while.
All you have to do is have a post in the forums.
The more posts you have the better the chance you have of winning.
What can you win?
Well the title says it all. See what that is on the ApexSQL Developer studio page. It's a whole lot of goodies!
Read contest details here.