BLOGS

ByDr. SubraMANI Paramasivam

Add a new column to every table in a database

This seems quite a painful job when so many start opening a table and add the new column name, datatype and save. But what about you have to do this for 200 tables in a database and say you have 10 databases. Hmmm…. Such a crap work doing manually but SQL Server infamiliar stored procedure comes to rescue at this point.

The below query can be used to add a new column to every single table in a database.

Use [db]
go
exec sp_MsForEachTable ‘alter table ? add Load_date datetime null’

Thats it. You are done. Change the database name for the other databases.

So it is not just adding a column to all table, but modifying anything similar for each table in a database. You can change the SQL statement within the single quotes.

Best of luck

ByDr. SubraMANI Paramasivam

Become a Sponsor

This Data Awareness Programme, brings the enlightenment to every individuals in
identifying the data and analyse them. Click here to become a sponsor.

 

ByDr. SubraMANI Paramasivam

SQL Server Advanced Options

Part -II – Configurations – Management Studio and sp_configure

In my previous article you should have been familiar with the query sp_configure to see the default values of all the list

of 16 options. Let us see the Advanced options here.

By default the show advanced options will have 0 in its value. To see and set the advanced options this has to be changed

to 1 and it can be changed back to 0 once done. The query for changing the option is
sp_configure ‘show advanced options’, 1
go
reconfigure

This query will change the config_value option to 1 and reconfigure will send the command to reload all of the values. Once

the value is changed to 1 and by running sp_configure again will display an extended list of 68 in SQL Server 2008 and 70

in SQL Server 2008 R2.

I am going to take you through some of the most commonly used options.

AWE

ByDr. SubraMANI Paramasivam

SQL Server 2008 Tools & Components

For every installation of SQL Server, we have to customize according to what has to be installed and for what purpose. The following are the list of components available in SQL Server 2008.

1. Database Engine:
This is the core component which stores, manipulates & manage data. Other features include relational, XML, full text search and replication.

2. Integration Services:
Integration services is responsible for ETL Layer. ETL stands for Extraction, Transformation & Loading. This component is used for extracting the data from the source system, transform accordingly and load it into the database in the 1st component.

3. Analysis Services:
Once the data is available in 1st component via the ETL layer in the second component, not all the shcema is in ready to us and hence those are processed and managed by creating Online Analytical Processing (OLAP) analysis and data mining model for Business Intelligence purpose.

4. Reporting Services:
Whatever transformation is done in 2nd component & 3rd component we need an end user component to see the result and this is achieved as interactive, tables, graphical representations, charts through Reporting services.

The following are the available tools in SQL Server
1. SQL Server Management Studio (SSMS)
This is the management tool to manage all the core components which we saw above.

2. Business Intelligence Development Studio (BIDS)
This tool allows a developer to develop cubes (Analysis Services), integration service packages, reports.

3. SQL Server Configuration Manager
Managing the connectivity components such as Server Network Utility, Client Network Utility, Service Manager is done using this tool. All the connectivity components was separate features in 2005 version and backwards.

4. SQL Server Profiler
All the events occured in SQL Server can be traced and saved for future use using this tool.

5. Database Engine Tuning Advisor
Shortly called DTA is used too analyse the load on the engine. The recommendations provided by DTA can be used to improve the query performance for the same query.

6. Command Prompt Utilities
This is another powerful utility that can be accessed via DOS prompt. You can go to cmd.exe and execute the following commands that have its unique magic work done without the knowledge of T-SQL.

A. bcp – bulk copy of data

B. dta – Database Engine Tuning Advisor

C. dtexec – configure and execute SSIS packages

D. dtutil – Manage SSIS package

E. sqlcmd – command line to execute T-SQL statements

F. rs – Manage Reporting services server

G. rsconfig – manage & configure report server connection

H. rskeymgmt – manage encryption keys on report server

I. sqlagent90 – to start SQL Server Agent

J. SQLdiag – Diagnostic collection by Microsoft

K. sqllogship – Operational tasks like copy, restore, backup operations

L. sqlservr – start and stop the database engine for an instance

M. Ssms – to open SSMS

N. sqlps – to run PowerShell commands

O. tablediff – capable of comparing data from 2 tables in replication topology.

ByDr. SubraMANI Paramasivam

SQL Server Memory limitations

There are totally 6 editions available in SQL Server and 4 Windows Server with 32 & 64 bit for each in 2008 and 3 for 2003 R2 SP2.