fn_get_sql() and DBCC INPUTBUFFER will be deprecated. Use sys.dm_exec_query_stats and sys.dm_exec_sql_text to see each recently executed T-SQL query.
geography Point: Latitude Comes Before Longitude
geography Point uses latitude, longitude and SRID arguments. Its coordinate order differs from POINT text, so inspect both returned properties.
SQL SERVER – Insert Values of Stored Procedure in Table – Use Table Valued Function
How do you insert values of stored procedure output into a table? The traditional temp table way, and an alternate method with a Table Valued Function.
Integer Division: Keep Quotient and Remainder Together
Integer division and modulo can reconstruct the original signed dividend. These read-only cases keep both operands, quotient, remainder and reconstructed value together.
Ordered Comma Lists With STRING_AGG and WITHIN GROUP
Build ordered comma lists with STRING_AGG and WITHIN GROUP, remove duplicates, handle nulls, and avoid fixed-length result limits.
SQL SERVER – Converting Stored Procedure into Table Valued Function
Not every stored procedure should become a Table Valued Function. Here is which kind of SP qualifies, mainly one whose output you insert into another table.
geometry STDimension: Count Dimensions, Not Points
geometry STDimension describes dimensionality rather than the number of coordinates. A mixed collection reports its highest-dimensional element.







