Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

isnull use in sql condition

Posted on 2011-09-12
2
278 Views
Last Modified: 2012-05-12
hello: i'm trying to get the right syntax for...

DECLARE @sessionId int

SELECT @sessionId = 1 + CONVERT(float,ISNULL(MAX(SESSIONID) FROM CONTROL.dbo.tblProgressHx,0))

PRINT @sessionID


thanks!
0
Comment
Question by:ironpen45
2 Comments
 
LVL 5

Accepted Solution

by:
DavidMorrison earned 500 total points
ID: 36523296
try this

select 1 + cast(ISNULL(MAX(SesionID), 0) as float) as SessionNew
from CONTROL.dbo.tblProgressHx

if you really want it in a variable then

DECLARE @sessionId int

select @SessionID = 1 + cast(ISNULL(MAX(SesionID), 0) as float) as SessionNew
from CONTROL.dbo.tblProgressHx

PRINT @sessionID


Thanks

Dave
0
 

Author Closing Comment

by:ironpen45
ID: 36523406
works like a charm. thanks!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question