SQL Server 2008 create procedure and create view

I was trying to create a view and a procedure. However none of them can be done.

I have tried creating the procedure like this:

create procedure name ( @time )
as 
begin
    select tag_ID from Location where tag_ID=@time;
end

create procedure name 
as 
    select tag_ID from Location where tag_ID=@time;
end

Both result in the following error

Major Error 0x80040E14, Minor Error 25501 create procedure name as select tag_ID from Location where tag_ID=@time There was an error parsing the query. [ Token line number = 1,Token line offset = 8,Token in error = procedure ]

For creating view

create view Time as select time from Location;

The error I received is:

Major Error 0x80040E14, Minor Error 25501 create view Time as select time from Location There was an error parsing the query. [ Token line number = 1,Token line offset = 8,Token in error = view ]

It seems to be some problem in using the CREATE, however i cannot figure it out.

I have tried most of the syntax but it seems not working, most of them pop out the same error.

** I am using SQL compact edition.

Answers


You're missing the type from the procedure parameter. Try something like this:

CREATE procedure name ( @time varchar(100)) 
AS BEGIN
    select tag_ID from Location where tag_ID=@time; 
END

Error Because You are missing datatype for procedure's parameter. Note : Please recheck which datatype you are using I'm using datetime here.

CREATE PROCEDURE Name (@time DATETIME)
AS
BEGIN
  SELECT tag_id
  FROM   location
  WHERE  tag_id = @time;
END  

Are you using Sql Server Database Engine or SQL CE? I think You are using SQL CE or Limited version in which View and Procedures are not allowed;

Ref http://social.msdn.microsoft.com/Forums/uk/sqlce/thread/f6ba9114-a962-41c2-b142-448c0f427cce


Need Your Help

Where to find free html templates to support multiple resolutions/browsers?

html css templates

Is there a website where I can download free css/html templates for a website to support multiple browsers and resolutions?