Monday, November 15, 2010

Microsoft SQL Insert Identity

Insert an identity into a table:

At any time, only one table in a session can have the IDENTITY_INSERT property set to ON. If a table already has this property set to ON, and a SET IDENTITY_INSERT ON statement is issued for another table, Microsoft® SQL Server™ returns an error message that states SET IDENTITY_INSERT is already ON and reports the table it is set ON for.

If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value.

Example:

-- Create products table.
CREATE TABLE products
(id int IDENTITY PRIMARY KEY, product varchar(40))
GO

-- Inserting values into products table.
INSERT INTO products (product) VALUES ('screwdriver')
INSERT INTO products (product) VALUES ('hammer')
INSERT INTO products (product) VALUES ('saw')
INSERT INTO products (product) VALUES ('shovel')
GO

-- Create a gap in the identity values.
DELETE products
WHERE product = 'saw'
GO

SELECT *
FROM products
GO

-- Attempt to insert an explicit ID value of 3;
-- should return a warning.
INSERT INTO products (id, product)
VALUES (3, 'garden shovel')
GO

-- SET IDENTITY_INSERT to ON.
SET IDENTITY_INSERT products ON
GO

-- Attempt to insert an explicit ID value of 3
INSERT INTO products (id, product)
VALUES (3, 'garden shovel')
GO

SELECT *
FROM products
GO

-- Drop products table.
DROP TABLE products
GO

Source: Microsoft Developer Network

Friday, August 13, 2010

Microsoft SQL MD5 Support

Microsoft SQL includes support for the MD5 hashing algorithm:

SELECT SUBSTRING(master.dbo.fn_varbintohexstr(HASHBYTES('MD5', 'String to MD5')), 3, 32);

Tuesday, July 13, 2010

New Microsoft Outlook Social Connectors Released

Microsoft has released Outlook Social Connectors for Facebook and Windows Live Messenger, both social connectors include 32 bit and 64 bit versions. Additionally LinkedIn and MySpace recently updated their social connectors; however, they have not yet released 64 bit versions.

Outlook Social Connectors bring all of your social networks into Microsoft Outlook.

Wednesday, February 24, 2010

Microsoft Outlook Social Connector

Outlook Social Connector 32 bit (Beta) is now available for download:

Stay up-to-the-minute with the people in your networks by accessing everything from e-mail threads to status updates in one single, centralized view.

Download Outlook Social Connector 32 bit (Beta)