Archive for the ‘Database’ Category

Introduction As a developer, the .NET framework and Visual Studio present many choices for choosing the right architecture, from placing the data access code directly in the UI through datasets and data source controls, to creating a data access layer that talks to the database, all the way to creating an n-tier architecture approach that [...]

There are three major theoretical differences between temporary tables: create table #T (…) And table variables: declare @T table (…) The first difference is that transaction logs are not recorded for the table variables. Hence, they are out of scope of the transaction mechanism, as is clearly visible from this example: create table #T (s [...]

When I was developing a small application, I had to write a Microsoft SQL Server script to check whether all the characters in a given string are uppercase alphabets or not. Here is the Microsoft SQL Server function code which performs the check. This code is compatible with Microsoft SQL Server 2000 and Microsoft SQL [...]

Why is SQL Server So Slow?

Posted: 23 November 2007 in Database, SQL Server

I’ve been asked this question a few times when looking into performance problems on a website, and the short answer is, it’s not. SQL Server is a very efficient database. It’s important to remember that a database is just a runtime for your SQL code. It’s just doing what you ask it to do, nothing [...]

SQL Optimization Tips

Posted: 16 August 2007 in Database, Technology

• Use views and stored procedures instead of heavy-duty queries. This can reduce network traffic, because your client will send to server only stored procedure or view name (perhaps with some parameters) instead of large heavy-duty queries text. This can be used to facilitate permission management also, because you can restrict user access to table [...]

Talking about Some SQL Queries

Posted: 3 July 2007 in Database

How to Run commands for all tables in current dB: EXEC sp_MSforeachtable @command1 = ‘DELETE FROM ? WHERE your_condition’ The ‘?’ will be replaced by the table name ——————————————————————————– How to find Size of all user tables with the number of rows: EXEC sp_MSforeachtable @command1=’sp_spaceuse d “?”‘ ——————————————————————————– How to find Number of rows in [...]