Wednesday, August 30, 2006

Executing SQL Scripts ?

 

Most of the deverlopers has this question, how to create the dev database using a wizard, I bevelie the easyest way out is to use the osql,

execute this in the command prompt.

osql /S (local) /U sa /O sa /i C:\script.sql

 

And I found this intersting artical about how to handle SQL failover functionalities with .NET,

 

http://www.doingitwith.net/2006/08/getting-warmer-...

Monday, August 28, 2006

USB Dunper

USBDumper is a cute little utility that silently copies the contents of an inserted USB drive onto the PC. Try it out here ..

 

http://www.schneier.com/blog/archives/2006/08/usbd...

 

 

RAM DRIVE ?

have you tried this yet ? cool

http://sqlblogcasts.com/blogs/tonyrogerson/archive...

Thursday, August 24, 2006

WinPOS

I spend y'day and today trying to implement promotion and loyalty funcanaliity to our winPOS. It was not that easy when I discuss the funcations, but when i put it in to a paper and wrote down the logic how to implelemnt it wasn't that much. prob i was thinking too much and strees out.

 

I found a very intersting artical today at SQLServerCentral check it out

http://www.sqlservercentral.com/columnists/sjones/...

 

SP to Script SQL Server tables ..

 

 

/********************************************************/
/****** Object:  Stored Procedure dbo.proc_genscript    
/******Script Date: 5/8/2003 11:06:52 AM ******/
/****** Created By:    Shailesh Khanal ******/
/********************************************************/
SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[sp_ScriptObject]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[sp_ScriptObject]
GO
/* This procedure will script out one object so it can be recreated using a T-SQL Script
Modified 11/18/04 to handle Alerts and Operators
Usage:
exec sp_ScriptObject 
       @ServerName = 'Server Name', 
       @DBName = 'Database Name', 
       @ObjectName = 'Object Name to generate script for', 
       @ObjectType = 'Object Type', 
       @TableName = 'Parent table name for index and trigger',
       @ScriptFile = 'File name to save the script'
*/
CREATE PROCEDURE sp_ScriptObject 
@ServerName VARCHAR(30), 
@DBName VARCHAR(30), 
@ObjectName VARCHAR(256), 
@ObjectType VARCHAR(10), 
@TableName VARCHAR(50),
@ScriptFile VARCHAR(256)
AS
DECLARE @CmdStr VARCHAR(256)
DECLARE @object INT
DECLARE @hr INT
SET NOCOUNT ON
SET @CmdStr = 'Connect('+@ServerName+')'
EXEC @hr = sp_OACreate 'SQLDMO.SQLServer', @object OUT
--Comment out for standard login
EXEC @hr = sp_OASetProperty @object, 'LoginSecure', TRUE
/* Uncomment for Standard Login
EXEC @hr = sp_OASetProperty @object, 'Login', 'sa'
EXEC @hr = sp_OASetProperty @object, 'password', 'sapassword'
*/
EXEC @hr = sp_OAMethod @object,@CmdStr
SET @CmdStr = 
CASE @ObjectType
WHEN 'Database' THEN 'Databases("' 
WHEN 'Procedure' THEN 'Databases("' + @DBName + '").StoredProcedures("'
WHEN 'View'     THEN 'Databases("' + @DBName + '").Views("'
WHEN 'Table'    THEN 'Databases("' + @DBName + '").Tables("'
WHEN 'Index'    THEN 'Databases("' + @DBName + '").Tables("' + @TableName + '").Indexes("'
WHEN 'Trigger'  THEN 'Databases("' + @DBName + '").Tables("' + @TableName + '").Triggers("'
WHEN 'Key'      THEN 'Databases("' + @DBName + '").Tables("' + @TableName + '").Keys("'
WHEN 'Check'    THEN 'Databases("' + @DBName + '").Tables("' + @TableName + '").Checks("'
WHEN 'Job'      THEN 'Jobserver.Jobs("'
WHEN 'Alert'    THEN 'Jobserver.Alerts("'
WHEN 'Operator' THEN 'Jobserver.Operators("'
END
SET @CmdStr = @CmdStr + @ObjectName + '").Script(5,"' + @ScriptFile + '")'
EXEC @hr = sp_OAMethod @object, @CmdStr
EXEC @hr = sp_OADestroy @object
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

Monday, August 21, 2006

Heavy Rainning

 

it was rainning in dah mornning as well as y'day whole day. I spent more than 10 hours with the laptop since i can't do any thing more than that.

 

there is a good atrical published @ http://www.sqlservercentral.com/columnists/dpoole/... for dah .NET Enterprise Library, i think it is a very baisc document that ever one can undestand, even me :)

Friday, August 18, 2006