Retrieving cloumn from SQL server stored proc

I

iHavAQuestion

I have to retrieve the cloums from the table, but there are few columns in a
table of datatype date and int and the default values are 9999-12-31
23:59:59.997 and -2147483648.

My questions is when I retreive them I sould get value as NOTHING, i mean
blank.

Can any one give me the solution.
 
N

Norman Yuan

You can do something like:

SELECT
CASE
WHEN DateColumn>'9999-12-31' THEN NULL
ELSE DateColumn
END AS DateColumn,
CASE
WHEN IntColumn<=-2147483684 THEN NULL
ELSE IntColumn
END AS IntColumn,
...
FROM theTable
WHER...

This just a simple and quick way. Of course you can have finer control with
more "WHEN...' in the CASE...END clause in conjunction with WHERE... to get
what you want to retrieve from the table
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,171
Messages
2,570,936
Members
47,472
Latest member
KarissaBor

Latest Threads

Top