There is table like Events...in that name ,startdate
,enddate,location are the column names
write a stored Procedure for this table to get events by
Months "GetEventsByMonths"

Answers were Sorted based on User's Feedback



There is table like Events...in that name ,startdate ,enddate,location are the column names write..

Answer / newbie

CREATE PROCEDURE GetEventsByMonths
@MONTH VARCHAR(15)
AS

SET NOCOUNT ON

SELECT name,DATENAME(MONTH,startdate) AS Startmonth
FROM Events
WHERE DATENAME(MONTH,startdate) = @MONTH
GROUP BY name,DATENAME(MONTH,startdate)

Is This Answer Correct ?    1 Yes 0 No

There is table like Events...in that name ,startdate ,enddate,location are the column names write..

Answer / krishna mohan thamisetty

select datename(mm, startdate) startdate, datename(mm,
enddate) enddate, location from t1

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More SQL Server Interview Questions

What are user-defined functions (udfs) in sql server?

0 Answers  


How do I port a number to sql server?

0 Answers  


Explain candidate key, alternate key, and composite key?

0 Answers  


What does sql server mean?

0 Answers  


What is a trigger? Why we need it?

0 Answers   Accenture,


What are the differences between having and where clause.

0 Answers  


what is checksum in sql server.........???

0 Answers   TCS,


Which sql server is best?

0 Answers  


What command do we use to rename a db, a table and a column?

0 Answers  


what are the different ways of moving data/databases between servers and databases in sql server? : Sql server database administration

0 Answers  


What command would you use to create an index?

0 Answers  


Creating Tables Using SELECT

1 Answers  


Categories