The Wiert Corner – irregular stream of stuff

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

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

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

    Join 1,861 other subscribers

Archive for the ‘SQL Server 2008 R2’ Category

SQL Server quick tip by Denis Gobo: use DBCC SHOWCONTIG for Min/Max/Average row sizes (via: sql server – Size of a single Record ? SQL – Stack Overflow)

Posted by jpluimers on 2012/11/22

Thanks SQLMenace (Denis Gobo) for this great tip on getting min/max/average row sizes (and more) using DBCC SHOWCONTIG.

Don’t forget the “with tableresults”, without it, it will skip the min/max/average recordsize from the results, and present the results as text (not as a row).

 

 

Run DBCC SHOWCONTIG with your table name

dbcc showcontig ('TableName') with tableresults

then look at max min and average record size

This feature works at least from SQL Server 2000 onward, though somewhere after SQL Server 2012 it will be removed.
As of SQL Server 2005 you can use sys.dm_db_index_physical_stats. An example on how to use that is here.

It just made me shiver when finding out an unindexed table with 9 million rows averaging about 300 bytes took 8 minutes to query.
Time to add some indexes, and have someone look at the disk back-end.

–jeroen

via: sql server – Size of a single Record ? SQL – Stack Overflow.

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

Research links: unit testing using SQL Server

Posted by jpluimers on 2012/10/16

Being used to do Unit Testing in most of my regular code, I want to do the same for SQL Server code.

Target is SQL Server 2000 and up (since I’m involved in a big migration project getting a lot of SQL Server 2000 data and code to be upgraded to SQL Server 2012 or SQL Server 2008 R2).

Here are a few links that are on my research list:

–jeroen

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

ROT13 – text obfuscation – T-SQL versions of the algorithm

Posted by jpluimers on 2012/10/11

Never call this encryption, as ROT13 is just a kind of obfuscation for text and can be easily revealed (like the reveal button in good old Teletext).

A few T-SQL versions of this algorithm, both working for SQL Server 2000 and up:

–jeroen

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

Elfproef as T-SQL UDF

Posted by jpluimers on 2012/10/09

As a follow-up on my earlier number validation posts (Elf proef in C# and Other number verifications), I found a nice T-SQL version of the Elfproef for Dutch bank account numbers.

It works at least from SQL Server 2000 and up, most likely also in the (unsupported) SQL Server 7.

–jeroen

via: Elfproef als T-SQL UDF.

Posted in .NET, C#, Database Development, Development, Software Development, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7 | Leave a Comment »

Upscene Productions: Database Workbench 4.3.1 free Lite Editions released

Posted by jpluimers on 2012/09/26

Database Workbench is my tool of choice for doing database work: it supports many backends in a consistent manner, and behaves a lot like Delphi (like running and debugging stored procedures).

Yesterday the free Lite Editions of Version 4.3.1 got released:

Database Workbench 4.3.1 free Lite Editions released

This new release of Database Workbench brings new features and enhancements, as requested by our users.

The free Lite Editions are now available.

More information about Database Workbench is available at the Database Workbench page, download your copy today via our downloads page, pricing information is available, the limited Lite Editions are available for free.

Changes in this release

  • The full details and list of changes are available here and here.
  • New
  • MySQL Stored Procedure, Function and Trigger Debugging (Pro Edition only)
  • InterBase and Firebird syntax check in Trigger Editor (Pro Edition only)
  • Incremental search of data in SQL, Table and View Editor

Changes

  • More compact taskbar
  • MySQL support for BINARY and VARBINARY datatypes
  • MySQL error fixed when not having access to mysql.procs
  • MySQL fix for fetching foreign key information
  • Data Import and Export fixes
  • Windows 7 event log error by SideBySide fixed

And much more…

–jeroen

via News @ Upscene Productions.

ITDevCon: Oct 25/26 2012 in Verona, Italy

Posted in Database Development, Delphi, Development, Firebird, InterBase, MySQL, OracleDB, PostgreSQL, Software Development, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7 | 1 Comment »

INFORMATION_SCHEMA views in various databases

Posted by jpluimers on 2012/08/21

Few people know about the INFORMATION_SCHEMA views that have been there since SQL-92.

Two funny things about that standard:

A few reasons I can imagine not many people know about the INFORMATION_SCHEMA:

  • Not all relational database servers implement them, and of the ones that do implement them, not all versions implement all views.
    That’s what this article is about; currently it lists only SQL Server 2000 and 2008 R2 (tried both) and PostgreSQL (verified docs), but I will update it as soon as I have run the script on other versions of SQL server and database vendors.
  • It is hard to find the official ISO standards in a public way, and ISO itself sometimes puts things online, and at other times wants money for it

    I remember the Y2K preparation era where the ISO-8601 standard was freely available at http://www.iso.ch/markete/8601.pdf, soon after the Year 2000, the PDF got locked behind a payment engine.
    ISO suffers from heavy link rot too, for instance the ISO 3166 country codes used to be at http://www.iso.org/iso/prods-services/iso3166ma, but are now at http://www.iso.org/iso/home/standards/country_codes.htm. What about HTTP 303 or 302 redirect here guys?

Since SQL-92, the INFORMATION_SCHEMA (and its twin DEFINITION_SCHEMA) have been extended. The last extension in 2008. Together they allow SQL databases to be self-describing (I think no vendor has attained that) and the structures queryable in a standard way

In fact that is the main purpose: these views in INFORMATION_SCHEMA are a very convenient standard way to query – in a vendor agnostic way – about tables, views, columns, etc. Read the rest of this entry »

Posted in Database Development, Development, Firebird, InterBase, ISO 8601, MySQL, OracleDB, PostgreSQL, Power User, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7, Sybase | Leave a Comment »

Great session on how to prevent SQL Injection Myths and Fallacies

Posted by jpluimers on 2012/08/15

A few weeks ago, Bill Karwin did a must watch webinar on the prevention SQL Injection titled  “SQL Injection Myths and Fallacies“.

Bill Karwin (twitter, new blog, old blog, Amazon) is famous for much work in the SQL database community, including InterBase/Firebird, mySQL, Oracle and many more.

He also:

Anyway, his webinar is awesome. Be sure to get the slides, watch the replay, and read the questions follow up.

Watching it you’ll get a better understanding of defending against SQL injection.

A few very valuable points he made: Read the rest of this entry »

Posted in .NET, .NET 3.5, .NET 4.5, .NET ORM, ASP.NET, Batch-Files, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Cloud Development, COBOL, CommandLine, Database Development, Delphi, Delphi for PHP, Delphi x64, Delphi XE2, Development, EF Entity Framework, F#, Firebird, FireMonkey, History, InterBase, iSeries, Java, JavaScript/ECMAScript, Jet OLE DB, LINQ, LLBLGen, MEF, Microsoft Surface, Mobile Development, PHP, PowerShell, Prism, Scripting, SharePoint, SilverLight, Software Development, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7, VB.NET, VBS, Visual Studio 11, Visual Studio 2002, Visual Studio 2003, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, Web Development, Windows Azure, WinForms, WPF, XAML, xCode/Mac/iPad/iPhone/iOS/cocoa | 1 Comment »

List of the bugs that are fixed in SQL Server 2008 R2 Service Pack 2

Posted by jpluimers on 2012/07/31

Close to 5 months after SQL Server 2012 got released to manufacturing, SQL Server 2008 R2 Service Pack 2 became available last week (July 26th, 2012).

A few links:

–jeroen

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

The ADO.NET Entity Framework and SQL Server 2000: the ProviderManifestToken attribute and selecting it with XPath

Posted by jpluimers on 2012/05/23

Yes. Dorothy. There are people using the ADO .NET Entity Framework with SQL Server 2000  in parallel of moving towards a more modern Microsoft SQL Server version.

Entity Framework is lovely for developing data-centric applications.

By default, Visual Studio 2010 will target SQL Server 2008 as a database. That is fine, but it is kind of invisible it does: there is no property or dialog where you can change this.

What you have to change in order to have the Entity Framework send SQL Server 2000 compatible queries is to:

  1. Right click your .edmx file
  2. Choose “Open with”
  3. Choose the “XML (text) editor”
  4. Find the  ProviderManifestToken attribute
  5. Change the value (usually from “2008”) into “2000”
  6. Save the .edmx file
  7. Build and run your application

A few caveats:

Read the rest of this entry »

Posted in .NET, .NET ORM, C#, C# 2.0, C# 3.0, C# 4.0, Development, EF Entity Framework, Software Development, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012 | Leave a Comment »

Checking which applications have a TCP connection to SQL Server (DTAP)

Posted by jpluimers on 2012/05/15

When in a DTAP environment, you cannot always have complete clean boundaries. Issues in production don’t reproduce in acceptance, you cannot develop in production, etc.

So sometimes you have to simulate or connect to Test or Acceptance Database Servers from a Develop workstation.

There it can get hairy to keep track of which applications connect to which database server.

That’s where the below batch file comes in handy: it scans your systems on connections to common TCP ports used by SQL server, then for each connection give you some process details (or – if you add a commandline parameter – all details that TLINK can get).

The batch file uses the built in tools tasklist, netstat, find and sc (the latter to show information on the local running SQL Services).

It also uses TLIST, which can be a bit awkward to get.

Read the rest of this entry »

Posted in .NET, Batch-Files, CSV, Database Development, Development, Scripting, Software Development, 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 »