Advertisement
Guest User

tsql_pro

a guest
Mar 6th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Dear Redgate.  SQL Prompt owns for the most part, but the autoformatting options are kind of weak.
  2. -- Here's the way I like to format my code.
  3. declare @dateOnly datetime
  4. if @dateOnly is not null
  5. begin
  6.     select
  7.         staffId, staffName, a,
  8.         day(@dateOnly)
  9.     from dbo.personnel
  10.         inner join
  11.         (   select fulladdresswithlongname
  12.             from b
  13.         ) ab on personnel.a = ab.a
  14.     where
  15.         len(empType) = 0
  16.         and empType in
  17.         (   'a', 'b', 'd', 'g', 'i', 'k', 'p', 'q', 'r', 's',
  18.             't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'D', 'F',
  19.             'I', 'K', 'M', 'N', 'O', 'Q', 'X', 'Z'
  20.         )
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement