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 2008 Forums
 Transact-SQL (2008)
 query conversion ms access to sql server

Author  Topic 

rahul_miche
Starting Member

3 Posts

Posted - 2009-08-11 : 02:58:36
hi i want to convert this query from msaccess to sql server

Here is the ms access query :

select [id],[broker] + ' [ ' + iif([isper],CStr([value]) + '%','KD ' + CStr([value])) + ' ]' as brokername from [broker] order by [broker]

problem is i use case statement there is no condition to check the iif[isper] part that is the reason it is giving error

i tried like this

select [id],[broker] + ' [ ' + (case when [isper] then [value] + '%' else 'KD ' + Cast([value] as nvarchar ) + ' ]' as brokername from [broker] order by [broker]

and here is the error i am getting

An expression of non-boolean type specified in a context where a condition is expected, near 'then'.
Its urgent.Any help would be really appreciated..
Thanks in advance
satish

rahul_miche
Starting Member

3 Posts

Posted - 2009-08-11 : 06:45:25
Hello can somebody pld help me on these query ?

here's hoping somebody will help...

Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-11 : 06:53:10
quote:
Originally posted by rahul_miche

hi i want to convert this query from msaccess to sql server

Here is the ms access query :

select [id],[broker] + ' [ ' + iif([isper],CStr([value]) + '%','KD ' + CStr([value])) + ' ]' as brokername from [broker] order by [broker]

problem is i use case statement there is no condition to check the iif[isper] part that is the reason it is giving error

i tried like this

select [id],[broker] + ' [ ' + (case when [isper] then [value] + '%' else 'KD ' + Cast([value] as nvarchar ) + ' ]' as brokername from [broker] order by [broker]

and here is the error i am getting

An expression of non-boolean type specified in a context where a condition is expected, near 'then'.
Its urgent.Any help would be really appreciated..
Thanks in advance
satish

check the condtion at when in case statement
case when [isper] then
Go to Top of Page

rahul_miche
Starting Member

3 Posts

Posted - 2009-08-11 : 07:16:18
Thnaks for the reply but there is no condition to check pls check the ms access query ... there is only column in the condition
Go to Top of Page
   

- Advertisement -