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 table

as

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

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........