View with parameter
hi,
i create view in sql server enterprise manager - view design, this:
select customer, name scheme.custm customer=?
there's sql syntax error message - "parameters cannot used in query type."
when run sql query in sql query analyzer as:
create view view_customer select customer,name scheme.custm customer=?
there's error as:
"count field incorrect or syntax error."
what's problem?
thank.
yabing
parameters not supported in views. instead can use udf more or less parameterised view
read user defined functions in sql server
eg
create
function fncustomer(
-- add parameters function here@customerid
varchar(20))
returns
tableas
return
(
select *from customers where customerid=@customerid)
go
-- function call
select
*from fncustomer ('alfki')
or
create view mentioned without parameter , in select statement give condition
select *from vwcustomer customerid=''alfki''
madhu
SQL Server > Getting started with SQL Server
Comments
Post a Comment