Thursday, May 24, 2007
Codeplex - Microsoft's answer for open source
Wednesday, May 23, 2007
Sql Server 2008 Code named Katmai
If you have been working on Sql Server 2005 you will understand how robust it is and the set of all new features it has compared to 2000, the next release katmai is adding on to sql 2005.
The good news is, it is adding to Sql 2005 and not like totally replacing it. Thank god or we got to learn a whole new set of stuff again :(
"Microsoft officials listed a number of overarching goals for SQL Server "Katmai" such as tighter integration with the 2007 Microsoft Office system. In addition, the release will make good on the parting pledge of Paul Flessner, former Microsoft senior vice president of the Data Storage and Platform Division, to go beyond relational data. SQL Server "Katmai" will enable users to manage any data type, including relational data, documents, geographic information and XML, company officials said.
In addition, the new version of the data management and analysis platform provides an integrated development environment with Microsoft Visual Studio and .NET Framework that will accelerate development of new applications with an increased level of data abstraction as well as permit developers to synchronize data from virtually any device into the central data store, company officials said. "
If you are interested to know more about katmai read about it here,
http://www.microsoft.com/sql/prodinfo/futureversion/default.mspx
Importance is being given to BI and integration with office 2007 and .Net 3.0
May be Microsoft should take it a little bit slower, they are too rapid. We are still riding on top of your car and if you go so fast we may take a deadly fall.
I know a lot of clients still use Sql Server 2000 and are still worried about even upgrading to Sql Server 2005.
Monday, May 21, 2007
Sql Server 2000 - Incorrect syntax near the keyword 'IDENTITY'
Let us say there is a table in sql server 2000 which does not have a identity key, you inspect it manually and find out that there is a column which is unique and you can make it in to an identity column and decide to go and open your Query analyzer and try to do an alter table add identity something like this,
ALTER TABLE [dbo].[projects] ALTER COLUMN [id] IDENTITY(100, 1) Not Null
Here i want the seed to start at 100 and increment by 1 since i got 99 rows already with proper ids.
But this would not run properly, we will get an error something like,
Incorrect syntax near the keyword 'IDENTITY'
There is no problem in the syntax the issue is sql 2000 cannot add an identity just like that to an column since there is lot of other background work that needs to be done.
So it is not possible to do it via single T-Sql statement.
But you can add the entire identity via enterprise manager very easily,
Just right click on the table >> design table >> click on the id column >> make identity = yes in the columns property area below and then set the identity seed (starting value) and the identity increment.
When you do this, this is what enterprise manager does in the background,
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
CREATE TABLE dbo.Tmp_projects
(
id int NOT NULL IDENTITY (101, 1),
name varchar(50) NULL
) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_projects ON
GO
IF EXISTS(SELECT * FROM dbo.projects)
EXEC('INSERT INTO dbo.Tmp_projects (id, name)
SELECT id, name FROM dbo.projects TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_projects OFF
GO
DROP TABLE dbo.projects
GO
EXECUTE sp_rename N'dbo.Tmp_projects', N'projects', 'OBJECT'
GO
ALTER TABLE dbo.projects ADD CONSTRAINT
Myuniqye UNIQUE NONCLUSTERED
(
id
) ON [PRIMARY]
GO
COMMIT
If you look at the above, it is basically creating a temporary table and inserting all the records from the main table and then renaming the temp table to original table name.
The problem is many projects want developers to save the script changes so that they can apply the same on to development / test / production servers, so developers want to save the script.
There is a way to do that too, actually 2 ways,
1) In Enterprise manager when you click design table and after you made the change, there is a small icon at the top which reads,"save changes script" (should be the third icon from the left if you have icons unmodified), so this basically scripts the entire change for you to save it.
2) Start Sql Profiler, perform the operation and then save changes script is the second way to do it.
This link too verifies the same,
http://www.sqlmag.com/Article/ArticleID/22080/sql_server_22080.html