Category: Database

SQL Injection-proof your integrated SQL search in ASP.NET 2.0

I had forgotten to add SQL Injection prevention logic when I integrated and implemented a SQL search function for my employer’s internal ASP.NET app.  So in this post, I’m adding it for archival and sharing purposes. SQL injection is an attack in which malicious code is inserted into strings that are...

Various SQL JOIN reference

One of the trickiest things about learning SQL is mastering how various JOIN statements differ in the ways they combine data from multiple data tables. There are three types of joins: inner, outer, and cross. In addition, there are three types of outer joins: left, right, and full. It can...

How to find the service pack version installed on SQL Server

Run and execute the following query; it doesn’t matter what database and/or table you’re in: select @@VERSION If executed successfully, you should get something like below, which shows that SP2 is installed. Microsoft SQL Server 2005 – 9.00.3042.00 (Intel X86)   Feb  9 2007 22:47:07   Copyright (c) 1988-2005 Microsoft Corporation  Enterprise...

Resetting Primary Key counter in SQL Server

To reseed/reset the IDENTITY column of an SQL Server table, run the following in Query Analyzer or SQL Server Management Studio: DBCC CHECKIDENT (Table_Name, RESEED, 1) Peace!...

Auto backup solution for your MySQL databases

I use MySQL as my database server, and thankfully, it’s been reliable and easy to use.  A qualm I have, however, is that it doesn’t include a daily backup feature, unlike Microsoft SQL Server. The good thing is that the open source community has seen this problem and created a...