SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


using isnull function in select query


using isnull function in select query

Author
Message
ssurekha2000
ssurekha2000
SSC-Enthusiastic
SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)

Group: General Forum Members
Points: 143 Visits: 207
select isnull(id,0)+1 as ID from TABLE1
i have the id field blank with defualt value as 0
but when i use the abobe query i dont get 1
select isnull(id,0) as ID from TABLE1 i dont get 0
Phil Parkin
Phil Parkin
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18389 Visits: 20423
What's your question?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
ssurekha2000
ssurekha2000
SSC-Enthusiastic
SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)

Group: General Forum Members
Points: 143 Visits: 207
i have a int column as Custid
initally value is balnk.
but i have set the default value when creating the field as 0
i need to increment the max Custid value
but if its null i need it be 0 so incrementing it would be 1


select isnull(Custid,0)+1 as ID from TABLE1
i have the Custid field blank with defualt value as 0
but when i use the abobe query i dont get 1
select isnull(Custid,0) as ID from TABLE1 i dont get 0
Phil Parkin
Phil Parkin
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18389 Visits: 20423
ssurekha2000 (7/15/2013)
i have a int column as Custid
initally value is balnk.
but i have set the default value when creating the field as 0
i need to increment the max Custid value
but if its null i need it be 0 so incrementing it would be 1


select isnull(Custid,0)+1 as ID from TABLE1
i have the Custid field blank with defualt value as 0
but when i use the abobe query i dont get 1
select isnull(Custid,0) as ID from TABLE1 i dont get 0


Can you provide DDL and sample data so that I can see what your source data looks like? See the link in my signature for details of how to do this.

Note that there is (potentially) a difference between 'NULL' and 'blank'.

And still you have not asked a question.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
ssurekha2000
ssurekha2000
SSC-Enthusiastic
SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)

Group: General Forum Members
Points: 143 Visits: 207
solved
Phil Parkin
Phil Parkin
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18389 Visits: 20423
ssurekha2000 (7/15/2013)
CREATE TABLE [dbo].[DETAILS](
[ID] [numeric](18, 0) IDENTITY(1,1) NOT NULL,

[CLENO] [int] NOT NULL CONSTRAINT [DF_DETAILS_CLENO] DEFAULT ((0)),
[Custid] [int] NOT NULL CONSTRAINT [DF_DETAILS_Custid] DEFAULT ((0)),
CONSTRAINT [PK_DETAILS] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]


Still no sample data and no questions ... I'm out.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
shirisha.0301
shirisha.0301
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 41
if solved please post ur solution surekha..
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search