View difference between Paste ID: j0Y1Bra1 and ct0mBVcn
SHOW: | | - or go back to the newest paste.
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-
3+
4
if @dateOnly is not null
5-
if @dateOnly is not null begin
5+
begin
6-
    select
6+
	select
7-
        staffId,
7+
		staffId, staffName, a,
8-
        staffName,
8+
		day(@dateOnly)
9-
        a,
9+
	from dbo.personnel
10-
        day(@dateOnly)
10+
		inner join
11-
    from dbo.personnel
11+
		(	select fulladdresswithlongname
12-
        inner join (
12+
			from b
13-
            select fulladdresswithlongname from b
13+
		) ab on personnel.a = ab.a
14-
        ) ab on personnel.a = ab.a
14+
	where
15-
    where
15+
		len(empType) = 0
16-
        len(empType) = 0
16+
		and empType in
17-
        and empType in (
17+
		(	'a', 'b', 'd', 'g', 'i', 'k', 'p', 'q', 'r', 's',
18-
            'a', 'b', 'd', 'g', 'i', 'k', 'p', 'q', 'r', 's',
18+
			't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'D', 'F',
19-
            't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'D', 'F',
19+
			'I', 'K', 'M', 'N', 'O', 'Q', 'X', 'Z'
20-
            'I', 'K', 'M', 'N', 'O', 'Q', 'X', 'Z'
20+
		)
21-
        )
21+