Geeks With Blogs
Nouman Zakir while (true) { Post.NewArticle(); } February 2009 Entries
Optional parameters in SQL Stored Procedures
You can add optional parameters in stored procedures by setting a default value for each parameter that you want to make optional. The default value is typically NULL, but it's not necessary. Example: CREATE PROCEDURE dbo.mySP @firstParam VARCHAR(32) = NULL, @secondParam INT = NULL AS BEGIN SET NOCOUNT ON SELECT * FROM [TableName] WHERE Param1 = @firstParam AND Param2 = @secondParam END GO -- EXEC dbo.mySP @firstParam ='bar', @secondParam =4 EXEC dbo.mySP @firstParam ='bar' EXEC dbo.mySP @secondParam ......

Posted On Saturday, February 28, 2009 5:48 AM

Check access to databse in SQL Server
HAS_DBACCESS returns information about whether the user has access to the specified database. Example: SELECT HAS_DBACCESS('Northwind'); returns 1 if the user has access to the database 0 if the user does not have access to the database NULL if the database does not exist Find all databases that the current user has access to SELECT [Name] as DatabaseName FROM master.dbo.sysdatabases WHERE ISNULL(HAS_DBACCESS ([Name]),0)=1 ORDER BY [Name] ......

Posted On Saturday, February 28, 2009 5:32 AM

Microsoft Help and Support
I got this joke in an email from my friend and I couldn't stop laughing. A plain computer illiterate guy rings tech support to report that his computer is faulty. Tech: What's the problem? User: There is smoke coming out of the power supply. Tech: You'll need a new power supply. User: No, I don't! I just need to change the start up files. Tech: Sir, the power supply is faulty. You'll need to replace it. User: No way! Someone told me that I just needed to change the start up and it will fix the problem! ......

Posted On Thursday, February 19, 2009 2:24 AM

Reset table identity (reseed) in SQL Server with DBCC RESEED
You may use DBCC CHECKIDENT to reseed (reset) the identity column of any table in SQL Server. Example: A table has 10 rows with 10 as last identity. The next record will automatically genrate 11, to start the new identity use the follwing T SQL query in query analyzer. DBCC CHECKIDENT (tableName, reseed, 15) To set the seed to zero use the following T SQL query in query analyzer. DBCC CHECKIDENT (tableName, reseed, 0) Avoid using a value lower than the current value, doing this will violate the uniqueness ......

Posted On Wednesday, February 11, 2009 3:59 AM

Very useful windows run commands
Different Run Commands useful for time saving while using your computer. To invoke the Run box, hold down the Windows key and hit R (or from the Start Menu, choose "Run.") From there type any one of the keywords listed to launch an app: like calc for Calculator or clpbrd for the Clipboard Viewer or freecell for the card game. Program Run Command Accessibility Controls access.cpl Accessibility Wizard accwiz Add Hardware Wizard hdwwiz.cpl Add/Remove Programs appwiz.cpl Administrative Tools control ......

Posted On Wednesday, February 11, 2009 3:48 AM

Find text in SQL stored procedures

Method to retrieve every text inside the stored procedures of a database

SELECT B.Name, *
FROM syscomments A INNER JOIN sysobjects B
ON A.id = B.id
WHERE A.text like '%tblNames%'

Posted On Monday, February 2, 2009 12:43 AM

Launch browser to display HTML contents
You can launch the default browser to display HTML content using the Process.Start method in the System.Diagnostics namespace by specifying the URL as the argument. But I don't recommend this approach because sometimes the browser will launch behind your application. A more reliable option is to use the Help.ShowHelp method to launch HTML content (even if the content is not on-line help). Call Help.ShowHelp with the active control as argument 1 (or use Form.Active Form). Specify the URL as argument ......

Posted On Monday, February 2, 2009 12:13 AM

Copyright © Nouman Zakir | Powered by: GeeksWithBlogs.net | Join free