Category Archives: SQL

Why hasn’t MS updated the SSRS Viewer in a while?

From https://connect.microsoft.com/SQLServer/feedback/details/798562/add-auto-refresh-option-for-reports-on-manage-report-page-to-report-manager Thanks for your feedback! When the report is going through the actual Report Viewer (e.g. Report Manager), we are using .NET to refresh the content, which runs into the issue you described in the initial post. To workaround … Continue reading

Posted in Brian's Code Extreme, C#, Servers, SQL | Tagged , | 1 Comment

When is your code done? When you finish the refactor refactor refactor rule.

Since unit test cases should be written before the actual code, you cannot say that code is done when the unit test all pass. You need the RRR rule. Legibility (Readability) Code that runs on and one in a single … Continue reading

Posted in Brian's Code Extreme, C#, C-Langs, JavaScript, NO SQL, PL-SQL, SQL, T-SQL | 1 Comment

A Well needed Foreign key query for T-SQL

What is one of the biggest pains of troubleshooting data manipulation in a database? Foreign key constraints. So one guys posted in Stack Overflow a query that mines every foreign key constraint out of your database for you. However, he … Continue reading

Posted in Brian's Code Extreme, SQL, T-SQL | Tagged , , , , | Leave a comment

More on T-SQL DateTimeOffset, DatePart,ToDateTimeOffset, SwitchOffset and Timezones

SELECT CAST(‘2007-05-08 12:35:29.1234567 +12:15’ AS datetimeoffset(3)) AS ‘datetimeoffset’ ,DATEPART(tz,CAST(‘2007-05-08 12:35:29.1234567 +12:15’ AS datetimeoffset(3))) AS ‘timezoneoffset’ ,TODATETIMEOFFSET(CAST(‘2007-05-08 12:35:29.1234567’ as datetimeoffset(3)), 735) as rebuilt datetimeoffset What we started with and want to end with. timezoneoffset What the DatePart extracted from the original … Continue reading

Posted in Brian's Code Extreme, SQL, T-SQL | Tagged , , | Leave a comment

Incrementing ID on a SQL row that you cannot use the Identity property with.

This is most common when the identity is not the primary key, and is tracked independently for each Foreign Key Ref. Example: Field Type OrderID Uniqueidentifier FK to the the order table. LineNumber Int The column that we need each … Continue reading

Posted in Brian's Code Extreme, SQL, T-SQL | Tagged , , | Leave a comment