45,000 Jobs - Get an Interview Call,  Post Your Resume Here
SURESHKUMAR.NET FORUMS
Registered Member Login:
Not a member? Register today!



Welcome to the SURESHKUMAR.NET FORUMS.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.




Microsoft SQL Server Tips

        

Reply
 
LinkBack Thread Tools Display Modes
Old 22-12-06, 04:19 PM   #1 (permalink)
Senior Member
 
LALIT KUMAR's Avatar
 
Join Date: Oct 2006
Location: new delhi
Posts: 183
Thanks: 21
Thanked 9 Times in 7 Posts
Rep Power: 6 LALIT KUMAR is on a distinguished road LALIT KUMAR is on a distinguished road
Microsoft SQL Server Tips

Avoid using NULL values in your SQL Server databases.
Pertains to SQL Server 6.5 and higher

Here's a short list of some of the problems you can expect to encounter if you use NULLs in your database.

1) Client applications require extra programming logic to handle NULL values.

2) Calculation, sorting, comparison and grouping operations can handle NULL values in unexpected and counterintuitive ways.

3) Aggregates and join operations also exhibit unexpected or counterintuitive results (e.g., COUNT(*) and COUNT(MyField) produce different results).

4) NULL values can lead to undesirable results for WITH CUBE, WITH ROLLUP, and other statistical operations.

5) Nullable columns that contain NULL values cause a small but measurable sacrifice in performance since SQL Server has to perform an additional check to determine whether the column allows NULL values.

Instead of allowing NULL values, you should set default values on your columns, such as 0 for numeric columns and an empty string ('') for text columns.
-----------------------------------------------------------

Return SQL Server resultsets in random order
Pertains to SQL Server 2000 and higher

There may be times when you want to return the records of a query in random order, such as return card values in a poker game application.
A quick way to do this is to use the NewID() function.

Example:

Code:

SELECT *FROM CardsORDER BY NewID()

-----------------------------------------------------------

Examine details about your SQL Server programmatically
Pertains to SQL Server 2000


Code:

SELECT SERVERPROPERTY('Edition')SELECT SERVERPROPERTY('IsSingleUser')SELECT SERVERPROPERTY('MachineName')SELECT SERVERPROPERTY('ProcessId')SELECT SERVERPROPERTY('ProductVersion')SELECT SERVERPROPERTY('ProductLevel')SELECT SERVERPROPERTY('ServerName')

-----------------------------------------------------------

Use DATEPART to display individual protions of dates and times.
Pertains to SQL Server 7.0 and higher

Example:

Code:

PRINT DATEPART(Mm, GETDATE())


Constants that can be used

Quote:
Milliseconds = Ms
Second = Ss
Minute = Mi
Hour = Hh
Day of the Week = Dw
Day of the Month = Dd
Day of the Year = Dy
Week = Wk
Month = Mm
Quarter of the Year = Qq
Year = Yy



If you know of any other tips or tricks pertaining to Microsoft SQL Server, feel free to post them here so that others may learn from them.

__________________
Lalit Kumar
09914097899

LALIT KUMAR is offline Offline   Reply With Quote
Reply

Tags
microsoft , server , sql , tips


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some Loadrunner FAQs kiran2710 Testing Tools & QA 1 25-10-08 12:42 AM
SQL Server 2005 Books Online (July 2006) vjsreevs ORACLE , SQL SERVER , SYBASE & Others 2 11-07-08 02:01 AM
Microsoft SQL Server Administrator sridhar Fresher Jobs 0 18-09-06 07:55 PM
hi..... gomesh_2k6 VB / ASP.NET Technologies 8 07-09-06 12:38 PM
Servers mahender9885 Aptitude Questions 2 21-02-06 03:02 AM


All times are GMT +6.5. The time now is 03:46 PM.

More Interview Questions Here...

Content Relevant URLs by vBSEO 3.3.0