Click here to Skip to main content
16,017,650 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have wrote some functions. i need view for that functions how to write query for that?
like example my function name and query
SQL
ALTER FUNCTION  [dbo].[Get_City]
(	
	-- Add the parameters for the function here
	@Id int
)
RETURNS TABLE 
AS
RETURN 
(
	-- Add the SELECT statement with parameter references here
	SELECT * FROM CITY
 )


how to write view for this please answer
Posted
Updated 9-Sep-13 2:16am
v2

I would request you to refer this link and get to know how to write view for SQL funtion

http://stackoverflow.com/questions/2877247/using-a-table-value-function-inside-a-view-in-sql-server[^]
 
Share this answer
 
Hi ,
You can pass parameter easily in Function which returns table data this is good approach, but to pass parameter to view is slightly different and using this method is also not advisable,

just sharing for your knowledge

You can use this method to pass your parameter to your view an then to your function..

set context_info 2

select convert(int, convert(binary(4), context_info)) from master.dbo.sysprocesses
where
spid = @@spid)



http://stackoverflow.com/questions/4498364/create-parameterized-view-in-sql-server-2008

Regards
Mubin
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900