Use UNION ALL rather than UNION wherever necessary. This will speed up the query exceution of the report
-
Create row numbers based on the rows available in a table
@ 2009-03-27 – 14:30:32
SELECT ROWID=IDENTITY(int,1,1) , EMPID, FNAME, LNAME
INTO EMPLOYEE2 FROM EMPLOYEE ORDER BY EMPID -
Parse Numbers from AlphaNumeric strings
@ 2009-03-27 – 14:04:55
CREATE FUNCTION [dbo].[ParseNumbers]
(
@string VARCHAR(50)
)
RETURNS VARCHAR(50)
AS
BEGIN
DECLARE @IncorrectCharLoc SMALLINT
SET @IncorrectCharLoc = PATINDEX('%[^0-9]%', @string)
WHILE @IncorrectCharLoc > 0
BEGIN
SET @string = STUFF(@string, @IncorrectCharLoc, 1, '')
SET @IncorrectCharLoc = PATINDEX('%[^0-9]%', @string)
END
SET @string = @string
RETURN @string
END
