How to series TSQL 2
6. How to find second highest
SELECT COL
FROM TABLE
ORDER BY COL DESC
OFFSET 1 ROWS
FETCH NEXT 1 ROWS ONLY;
7. How to use multiple cte
;with cte1
as
(select col1, null as col2 from Tab),
cte2
as
(
select col2, null as col1 from Tab
)
select * from cte1
union
select * from cte2
8 How to rename column
EXEC sp_rename 'TABLENAME.OLD_COLUMNNAME', 'NEW_COLUMNAME', 'COLUMN';
.
No comments:
Post a Comment