Sunday, 4 October 2015

If the parameter values are available in text/csv file



----------------------- File loading into temp table ------------------------
-- Temp table creation

CREATE TABLE #Hyperlink
(
Sl_Num INT
,URL VARCHAR(1000)
,Description VARCHAR(500)
,ActiveFlg SMALLINT
)

-- Temp table inserrtion
BULK
INSERT #Hyperlink
FROM 'C:\Kiran\SQLServer\SSRS\HyperLinks.csv'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

----------------------- Query to extract required URL from temp table ------------------------

SELECT URL FROM #Hyperlink
WHERE Description = 'Google'
AND ActiveFlg = 1

No comments:

Post a Comment