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
 Transact-SQL (2000)
 If Statement

Author  Topic 

michpaust
Starting Member

21 Posts

Posted - 2005-04-19 : 09:43:53
I am new to T-SQL. I used SQL statements in Access and they were easy enough, but I am having porblems with the syntax and how to make things 'flow' properly, so to speak.

I am in the process of transfering an Access statement to T-SQL. Its an 'iif' statement and this is what I have so far

Access Statement - IIF(Mid[m_pohead]![print_flag],7,1)="Y","Yes","No") as Confirmed

If(substring(m_pohead.print_flag,7,1),='Y','Yes','No')as 'Confirmed'

Forgive me if I sound stupid, but having worled with Access for almost 8 years its seemed like it was going to be an easy transfer biut I am finding that the simple code is more difficult than anything else. Please help.

Thank you

X002548
Not Just a Number

15586 Posts

Posted - 2005-04-19 : 09:51:40
Is [m_pohead]![print_flag] a Control on an Access form?

Or a column in a table.

If it's a column..then

CASE WHEN SUBSTRING([m_pohead].[print_flag],7,1)='Y' THEN 'Yes' ELSE 'No' END as Confirmed


Brett

8-)
Go to Top of Page

michpaust
Starting Member

21 Posts

Posted - 2005-04-19 : 10:41:26
Thank you Brett. That worked perfectly. Maybe I'll get this thing after all!
Go to Top of Page
   

- Advertisement -