Skip to main content

Posts

Showing posts from November, 2009

SQL Script to Create Tables

Continued from previous post “ SQL Script to Create Database ” IF NOT EXISTS ( SELECT * FROM sys.objects WHERE object_id = OBJECT_ID (N ' [dbo].[Product] ' ) AND type in (N 'U' )) BEGIN CREATE TABLE [dbo].[Product](     [ProductID] [int] PRIMARY KEY IDENTITY (1,1) NOT NULL,     [Name] [varchar](50) NULL,     [Description] [varchar](100) NULL,     [Modified] [timestamp] NOT NULL ) END GO SET IDENTITY_INSERT [dbo].[Product] ON INSERT [dbo].[Product] ([ProductID], [Name], [Description]) VALUES (1, N 'Red Bull' , N 'This drink gives you wings.' ) INSERT [dbo].[Product] ([ProductID], [Name], [Description]) VALUES (2, N 'Orange Juice' , N 'This drink goes better with Red Bull.' ) INSERT [dbo].[Product] ([ProductID], [Name], [Description]) VALUES (3, N 'BBQ Chicken' , N 'Yummy chicken for your tummy.' ) INSERT [dbo].[Product] ([ProductI

SQL Script to Create Database

USE master GO if exists ( select * from sysdatabases where name =' MyDatabase ')         drop database Chinthaka go DECLARE @device_directory NVARCHAR (520) SELECT @device_directory = SUBSTRING ( filename , 1, CHARINDEX ( N 'master.mdf' , LOWER ( filename )) - 1) FROM master.dbo.sysaltfiles WHERE dbid = 1 AND fileid = 1 EXECUTE (N' CREATE DATABASE MyDatabase   ON PRIMARY (NAME = N' ' MyDatabase ' ', FILENAME = N ' ' ' + @device_directory + N' MyDatabase .mdf' ')   LOG ON (NAME = N' ' MyDatabase _log' ',  FILENAME = N ' ' ' + @device_directory + N' MyDatabase .ldf ' ' ) ' ) go exec sp_dboption ' MyDatabase ','trunc. log on chkpt.','true' exec sp_dboption ' MyDatabase ','select into/bulkcopy','true' GO set quoted_identifier on GO USE [

How To : Add Follow Me on Twitter to your blog

Twitter is a developing popular social network.so everybody would like to communicate through twitter.If we have a way to connect twitter with our blog it will be easy for our followers.So lets see how we can do it. Step 1 Add HTML/JavaScript Page Element Step 2 Add this code segment to it. <center><a href=http://twitter.com/ yourusername ><img width="142" src=" http://img18.imageshack.us/img18/7093/twitterbutton0108.png " height="48" title="Follow Me"/></a> </center> Change yourusername with your twitter id Step 3 Save it.that’s all.