TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
albert albert
NA
524
0
Making QUErY from stored procedure to SQL
Sep 9 2013 7:04 AM
HI everybody,
I have this:
[code]
OPEN @WeekdayCursor
--
--SET @Weekdays = ''
--FETCH NEXT FROM @WeekdayCursor
--INTO @PriceAddID, @StartDate, @EndDate, @Weekdays
--
--WHILE @@FETCH_STATUS = 0
--BEGIN
--DECLARE @Position int
-- SET @Position = 0
--
-- DECLARE @NumDays int
-- SET @NumDays = DATEDIFF(day, @StartDate, @EndDate)
--
-- DECLARE @CurrentDate datetime
-- DECLARE @CurrentBWeekday int
-- DECLARE @Weekday int
--
-- WHILE (@Position < @NumDays + 1)
-- BEGIN
-- SET @CurrentDate = DATEADD(day, @Position, @StartDate)
-- -- Remember, SET DATEFIRST 1 for Monday
-- SET @CurrentBWeekday = dbo.f_BWeekday(@CurrentDate)
-- -- Validate the weekday
-- --SET @Position = @Position + 1
-- IF (@Weekdays > 0 AND @CurrentBWeekday & @Weekdays <> @CurrentBWeekday)
-- BEGIN
-- SET @Position = @Position + 1
-- CONTINUE
-- END
-- SET @Weekday= (SELECT dbo.f_Bweekday(@CurrentDate))
-- INSERT INTO #weekdayprice VALUES(@PriceAddID, @StartDate, @EndDate, @Weekday)
-- SET @Position = @Position + 1
-- END
--
----Logic
--FETCH NEXT FROM @WeekdayCursor
--INTO @PriceAddID, @StartDate, @EndDate, @Weekdays
--END
--
--CLOSE @WeekdayCursor
--DEALLOCATE @WeekdayCursor
[/code]
But I want to make a query of it. Because If you execute the weekDayCursor then the performance is very slow, like 20 minutes.
THX
Reply
Answers (
7
)
Sql command does not give output
Problem SQL Query