THE SQL Server Blog Spot on the Web
Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

Browse by Tags

All Tags » Tips and Tricks   (RSS)
  • 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
  • Increase Your Productivity With Query Analyzer/SQL Server Management Studio

    Drag And Drop Column Names In Query Analyzer you can save a lot of time by using this trick instead of typing all the column names of a table Hit F8, this will open Object Browser Navigate to DatabaseName/TableName/Columns Click on the column folder and drag the column folder into the Code Window Upon release you will see that all the column names ...
    Posted to Denis Gobo (Weblog) by Denis Gobo on September 24, 2007
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement