Unable to use a working query in a SQL Server View: 'IS' not recognized '>' not recognized -
i have query running if used directly string query:
select bi.customer_code [customer code], bi.add_name customer, si.account_code [account code], bid.bill_no [bill #], bi.bill_date [bill date], bi.cashier_no [cashier #], c.location, bid.service_code [service code], si.name service, bid.fees [service fee], bid.requested_qty [requested quantity], bid.requested_qty * 10 [knowledge fee], bid.requested_qty * 10 [innovation fee], bid.item_tot + bid.requested_qty * 20 total, bid.requested_qty * bid.fees [total w/o gov. fee], iif(bi.remarks null, '', iif(len(bi.remarks) > 100, concat(left(bi.remarks, 100), '...'), bi.remarks)) [remarks] dbo.bill_info bi inner join dbo.bill_info_detail bid on bi.bill_no = bid.bill_no , bi.cashier_no = bid.cashier_no , bi.pay_mode = bid.pay_mode inner join dbo.cashier c on bi.cashier_no = c.cashier_no inner join dbo.service_info si on bid.service_code = si.service_code (bi.pay_mode = '3') , (bi.input_status = '1') , (month(bi.bill_date) = month(getdate())) , (year(bi.bill_date) = year(getdate())) , (bi.account_code in ( 'adp', 'asp' )) , (bid.service_code not in ( 314, 1636, 1637, 1538 )) order [customer code], [bill date]
but once try use in view, these errors:
error in list of function arguments: 'is' not recognized. error in list of function arguments: '>' not recognized. unable parse query text.
if remove last column iif, works fine. why query not accepted in view?
version: microsoft sql server 2017 (rc1) - 14.0.800.90 (x64) jul 11 2017 07:03:16 copyright (c) 2017 microsoft corporation. rights reserved. express edition (64-bit) on windows 10 enterprise insider preview 10.0 (build 16257: ) (hypervisor)
using ssms create view using designer:
edit: updated query show better joins posted in wrong query using better one
with @sepupic's comment help, able create view through query instead of designer. view cannot designed anymore error still there i'm able call view , data , success me.
Comments
Post a Comment