Thursday, May 24, 2007

Codeplex - Microsoft's answer for open source

I was amazed to see the list of open source microsoft projects available at code plex.

Some of the popular ones which we have been using like the Atlas and the Ajax extension sample controls are all from codeplex.
"CodePlex is Microsoft's open source project hosting web site. You can use CodePlex to create new projects to share with the world, join others who have already started their own projects, or use the applications on this site and provide feedback"



The license details are provided here,



Few projects which are very impressive are,


1) BlogEngine.Net - your own dot net blog engine

2) Scorm 2004 implementation for dot net

3) Sharepoint utilities

4) Sandcastle help file builder - for VS2005 IDE (very helpful)

5) Same Desk - brings desktop on the web (unlike silverlight i did not have to install anything to see those applications very impressive) snapshot attached below.

On SameDesk i open a calculator, was able to browse this blog and also search something on the map on the left hand side and the web page looks exactly like a desktop and the app looks like a windows application. :)
you can try this out here live - http://www.openspot.com/


Some implementations given above would take several months if teams were to start coding them from scratch and some i could not believe if it may be completed, but code plex gives the entire source code free.
Every dot net developer should check codeplex without fail.
Also there are server enterprise patterns & implementations.

Wednesday, May 23, 2007

Sql Server 2008 Code named Katmai

Sql Server 7.0 followed by Sql Server 2000 followed by Sql Server 2005 and the next release is Sql Server 2008 or code name "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'

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