THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Browse by Tags

All Tags » tips and tricks   (RSS)
Showing page 2 of 3 (21 total posts)
  • Disaster Recovery for Your Windows Mobile Phone

    Right after doing a hard reset of my Windows Mobile phone, I realized that my phone’s contacts hadn’t been backed up. Now that’s a disaster! I had Kalen Delaney’s and Paul Nielsen’s cell phone numbers on my cell phone – not something to lose. From the MVP newsgroup for Windows Mobile devices, I found out about the beta version of Microsoft ...
    Posted to John Paul Cook (Weblog) by John Paul Cook on April 12, 2009
  • Finding Tables Without Referential Integrity

    Following up on yesterday's post from Louis, sometimes you encounter databases with missing referential integrity constraints. Even when the database is intended to have RI, accidents happen. Maybe a script dropped RI constraints before a bulk load and didn't quite get all of the constraints recreated. Whatever the reason, it's good to have a ...
    Posted to John Paul Cook (Weblog) by John Paul Cook on April 8, 2009
  • SQL Server 2008 Management Studio tip: Status Bar Custom Colors

    Joni Moilanen has a very nice tip about how you can use custom colors in the status bar so that you don't truncate that production table yet again :-) Check it out here:
    Posted to Denis Gobo (Weblog) by Denis Gobo on August 13, 2008
  • SQL Tip, Compiling Your SQL Without Running It To See If It Would Run

    Let's say you have a big SQL script with a ton of code and you want to make sure it runs but you don't want to execute it because it updates tables, deletes data etc etc.Take this simple example SELECT GETDATE() GO SELECT 1/asasasas GO You can probably guess that the second statement is not valid, when you have a lot of code it is more ...
    Posted to Denis Gobo (Weblog) by Denis Gobo on August 13, 2008
  • How to log when a function is called?

    This question came up today and here is one way of doing it. It requires running xp_cmdshell so this is probably not such a good idea.The problem with functions is that you cannot just insert into any table. INSERT, UPDATE, and DELETE statements modifying table variables local to the function.EXECUTE statements calling an extended stored ...
    Posted to Denis Gobo (Weblog) by Denis Gobo on May 8, 2008
  • Do you depend on sp_depends (no pun intended)

    I answered this question on the MSDN forums: How can I search all my sprocs to see if any use a function? Several people suggested using sp_depends. You can't really depend on sp_depends because of deferred name resolution. Take a look at this First create this proc CREATE PROC SomeTestProc AS SELECT dbo.somefuction(1) GO now create this ...
    Posted to Denis Gobo (Weblog) by Denis Gobo on May 6, 2008
  • How To Use COALESCE And NULLIF To Prevent Updating Columns When A Parameter IS NULL Or A Default Value

    A variation of this question popped up twice in the SQL programming newsgroup since yesterday, this means it is time for a blogpost.Let's say you have a proc like this CREATE PROC prUpdateTable@Salesman int = -1AS..........If the user calls the proc like this exec prUpdateTable null then @Salesman will be null, if the user calls the proc like ...
    Posted to Denis Gobo (Weblog) by Denis Gobo on March 28, 2008
  • Keep Your Server Clean by Using Virtual Applications

    It's pretty well understood that it's highly desirable to keep servers lean and mean. But what do you do when you need to use a tool, particularly if it is needed only once? You could install the utility application and then remove it, but that does introduce risk. Virtual applications provide the answer. You can actually run an application ...
    Posted to John Paul Cook (Weblog) by John Paul Cook on January 30, 2008
  • Tip: Find all The Rows Where Any Of The Columns Is Null Or Zero Or Both

    This question is asked every now and then so I decided to do a little blog post. How can you quickly without writing a bunch of OR statements determince if any columns have a NULL value, a value of 0 or if the value is 0 or NULL?To test for NULL is very easy, you just concatenate the columns since NULL + anything else is always NULL. Okay that ...
    Posted to Denis Gobo (Weblog) by Denis Gobo on January 25, 2008
  • Use the *1 trick to do math with two varchars

    Someone had code like this on the tek-tips forum DECLARE @v varchar(24) SELECT @v ='06029202400250029' SELECT RIGHT(@v,4) -SUBSTRING(@v,10,4) If you run this code, you will get the following message Server: Msg 403, Level 16, State 1, Line 4Invalid operator for data type. Operator equals subtract, type equals varchar. Instead of casting to ...
    Posted to Denis Gobo (Weblog) by Denis Gobo on January 2, 2008
Privacy Statement