Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Convert Int FUNCTION from Access to SQL Function

Author  Topic 

jennypretty
Yak Posting Veteran

96 Posts

Posted - 2004-10-07 : 11:22:09
Hello friends,
This is Access query:
select Int(nz(emp_hours),0)
FROM emp

In SQL:
CREATE VIEW emp_vw AS
select Int(nz(emp_hours),0)
FROM emp

It doesn't recognize INT function, do you know how to convert the INT function in access to SQL function?
Thanks.
Jenny.



The stupid question is the question you don't ask.
www.single123.com

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2004-10-07 : 11:30:12
CREATE VIEW emp_vw
AS
SELECT CONVERT(INT, emp_hours)
FROM emp

Mark
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-07 : 11:39:34
jenny -- remember that handy Access/SQL conversion I gave you? That should tell you how to translate the NZ() from Access into SQL.

otherwise, Mark has it right -- use CONVERT (or CAST) in T-SQL. Do you have books on-line or a good beginning T-SQL book?

- Jeff
Go to Top of Page

jennypretty
Yak Posting Veteran

96 Posts

Posted - 2004-10-07 : 11:57:33
That does the INT job, but not NZ function.
Smith, I got the ISNULL to replace for nz in access.
I got one sql book, but one book never has enough information.
My question is, how do I create a sql view based on this access query?
select Int(nz(emp_hours),0)
FROM emp

Thanks.
Jen.

The stupid question is the question you don't ask.
www.single123.com
Go to Top of Page

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2004-10-07 : 12:06:53
Sorry Jenny, missed that NZ(). I'm not very familiar with Access functions having not touched it for several years!
You can approximate this in SQL with:

SELECT CONVERT(INT, ISNULL(emp_hours, 0))
FROM emp



Mark
Go to Top of Page

jennypretty
Yak Posting Veteran

96 Posts

Posted - 2004-10-13 : 11:50:59
David, it worked successfully. Thanks so much.
Jenny.

The stupid question is the question you don't ask.
www.single123.com
Go to Top of Page
   

- Advertisement -