January 16th, 2005, 05:42 PM
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.
ORDER BY NewID()
Examine details about your SQL Server programmatically
Pertains to SQL Server 2000
Use DATEPART to display individual protions of dates and times.
Pertains to SQL Server 7.0 and higher
Constants that can be used
PRINT DATEPART(Mm, GETDATE())
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.
Last edited by Memnoch; January 2nd, 2006 at 08:26 PM.
January 18th, 2007, 01:32 PM
What is the default value for a Date field that hasn't been filled?
Originally Posted by Memnoch
January 18th, 2007, 01:56 PM
January 2nd, 2008, 08:39 AM
what will happen when I querry this from any dataset->tableadapter. Will this not force constraint error, whenever I will not use all non-null fields in my querry ....?
January 30th, 2009, 01:28 AM
MySQL does not allow setting the default value of a column to an expression. TIMESTAMP columns are a limited exception. A simple trigger is something like this:
Originally Posted by bzlomke
CREATE TRIGGER triggerName
BEFORE INSERT ON yourTable
FOR EACH ROW
SET NEW.date = curdate();
June 21st, 2011, 02:22 AM
Very useful tips for me...I am just newbie for MS SQL
October 19th, 2011, 04:45 AM
There are some tips which can help you:
Use ALTER DATABASE to Move Databases.
Play it Safe and Configure a Fail-Safe Operator .
Configure SQL Server Agent to Restart Services Automatically .
How to use Windows PowerShell to Manage SQL Server .
Create Server Groups to Manage SQL Server .
Learn About Manually Tweaking Parallel Processing Settings .
Know when not to Maximize Data Throughput for Network Applications.
December 3rd, 2011, 03:30 AM
I used to work in a location in which a common practice was to make use of Set Programming. I remember the number of little issues we could learn from one another whenever working together around the code. Picking up brand new cutting corners, code snippets and so on. with time considerably improved our effectiveness associated with composing signal.
Since i have began dealing with SQL Host I have been remaining by myself. The very best routines I'd normally select from working with other people that we cannot do right now.
So here is the question:
What are a person tips on effectively writing TSQL signal using SQL Host Management Studio?
Please keep the tips to 2 - 3 things/shortcuts that you simply believe enhance you pace associated with coding
Please stay within the range of TSQL and SQL Server Management Studio 2005/2008 If the feature is actually specific to the edition associated with Administration Facilities make sure you indicate: at the.g. “Works with SQL Server 2008 only"
I am afraid that I might have been misinterpreted by a number of a person. I am not searching for tips for composing effective TSQL code but instead for suggestions about how to efficiently make use of Administration Facilities to hurry in the coding procedure itself.
The kind of solutions that i'm looking for tend to be:
utilization of templates,
utilization of IntelliSense plug ins and so on.
Essentially individuals little things which make the actual html coding encounter a little more efficient and pleasant.
January 19th, 2012, 06:10 AM
Microsoft SQL Server Tips
I have no tip yet but share you all different domain wrkgroups, The remote server can be in the same domain, a different domain, or no domain at all (workgroup). How do we configure Log Shipping to work with a secondary server that is in a different domain or workgroup than our primary server? Check out this tip to learn more....
February 8th, 2012, 11:18 PM
Really a very professional forum, will come back for more.
Code 39, barcode, EAN-13, EAN-8