The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,681 other followers

Archive for the ‘SQL Server’ Category

SQL Server, Modulo, floats

Posted by jpluimers on 2016/12/08

SQL server % (modulo, not mod) operator doesn’t like floats (with reason).

You should get rid of the floats as they will give inaccurate results.

As a workaround, cast either through an integer or through a decimal: sql server modulo float – Google Search

CAST(CAST(TheInaccurateFloatValue AS decimal(38,19)) % ModuloValue AS float)

The decimal(38,19) is the maximum non-float precision you get.

( cast(dividend as integer) % divisor ) + ( dividend - cast(dividend as integer))

–jeroen

Posted in Algorithms, Database Development, Development, Floating point handling, Software Development, SQL, SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014 | Leave a Comment »

Common Table Expressions: no nesting, but consecutively usage – via Stack Overflow

Posted by jpluimers on 2016/09/28

Common table expressions are awesome. They work in at least Oracle and SQL Server.

You cannot nest them, but you can use them consecutively. Thanks spender for explaining that:

WITH
x AS
(
SELECT * FROM MyTable
),
y AS
(
SELECT * FROM x
)
SELECT * FROM y

–jeroen

via: sql – Can you create nested WITH clauses for Common Table Expressions? – Stack Overflow.

Posted in Development, Database Development, SQL Server, SQL Server 2008, SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, OracleDB, SQL Server 2014 | Leave a Comment »

Fixing 84b40000 error on SQL Server 2008 updates (like KB2977321 and KB2285068) via: Microsoft Community

Posted by jpluimers on 2015/07/14

When installing SQL Server 2008 Service Pack 3 related updates, some don’t like compressed directories (even if the database files themselves are uncompressed).

I found this holds at least for KB2977321 and KB2285068.

For x86 systems, ensure these directories are not compressed:

C:\Program Files\Microsoft SQL Server
C:\Program Files\Microsoft SQL Server Compact Edition

For x64 systems, ensure these directories are not compressed:

C:\Program Files\Microsoft SQL Server
C:\Program Files x86\Microsoft SQL Server
C:\Program Files x86\Microsoft SQL Server Compact Edition

–jeroen

via: Can not install KB2285068 Error Code 84B40000 – Microsoft Community.

Posted in Database Development, Development, Power User, SQL Server, SQL Server 2008, SQL Server 2008 R2, Windows | Leave a Comment »

TSQL: showing database level and server level permissions

Posted by jpluimers on 2014/06/12

A few short scripts checking out the cause for TFS Integration Tools refuses to start despite an admin being able to create a TEST database. Read the rest of this entry »

Posted in Database Development, Development, SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012 | Leave a Comment »

Venn Diagrams of SQL Join queries (via: Data Visualization – Google+)

Posted by jpluimers on 2014/04/08

Some great venn diagrams of SQL JOINs via Data Visualization – Google+ of which I wish they were PNG:

Thanks to that link, I found the original article and images by C.L. Moffat!

Click on the image to view a larger version.

–jeroen Read the rest of this entry »

Posted in Access, Database Development, DB2, Development, Firebird, InterBase, MySQL, OracleDB, PostgreSQL, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7 | Leave a Comment »

 
%d bloggers like this: