[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Migrate SQL Server Stored Procedures to MySQL

Asked by FirePits in MySQL Server, MS SQL Server, SQL Server 2005

Tags: MySQL

I am in the process of migrating from SQL Server to MySQL database for use with a coldfusion application. In particular, I am stuck in the process of converting the stored procedures. I could really use some help converting the syntax and addressing any other problems that may arise. I am starting with an attempt to convert a single stored procedure and then I figure the rest should fall into place. Here's the example that I'm trying to work with:

****COLDFUSION TAG****



<cfstoredproc procedure="SP_Total_Utilization_Snapshot_Report" datasource="resources">
      <cfprocparam cfsqltype="cf_sql_varchar" dbvarname="@startingWeek" value="#startingWeek#" type="in">
      <cfprocparam cfsqltype="cf_sql_int" dbvarname="@employeeid" value="#employeeid#" type="in">
      <cfprocresult name="getReport">
</cfstoredproc>



****STORED PROCEDURE FROM SQL SERVER****



CREATE PROCEDURE [dbo].[SP_Total_Utilization_Snapshot_Report]
      -- Add the parameters for the stored procedure here
      @startingWeek datetime,
      @employeeid int
AS
BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;

    -- Insert statements for procedure here
      select b.projectname, b.projectid, a.employeeid, c.fname + '' '' + c.lname as EmployeeName, d.role, a.taskDate, b.isBillable, c.showUtilization
into #temp_projects
from td_projectsTasks a join td_projects b on a.projectid=b.projectid
      join td_Employees c on a.employeeid=c.employeeid
      join td_Roles d on a.roleid=d.roleid
where a.taskDate >= @startingWeek and c.showUtilization = 1
order by b.projectname

select
distinct a.projectid, a.employeeid, b.isBillable, b.showUtilization,
''Week1'' = Case When (a.taskDate = @startingWeek) Then hoursProposed Else 0 End,
''Week2'' = Case When (a.taskDate = DateAdd(dd,7,@startingWeek)) Then hoursProposed Else 0 End,
''Week3'' = Case When (a.taskDate = DateAdd(dd,14,@startingWeek)) Then hoursProposed Else 0 End,
''Week4'' = Case When (a.taskDate = DateAdd(dd,21,@startingWeek)) Then hoursProposed Else 0 End,
''Week5'' = Case When (a.taskDate = DateAdd(dd,28,@startingWeek)) Then hoursProposed Else 0 End,
''Week6'' = Case When (a.taskDate = DateAdd(dd,35,@startingWeek)) Then hoursProposed Else 0 End,
''Week7'' = Case When (a.taskDate = DateAdd(dd,42,@startingWeek)) Then hoursProposed Else 0 End,
''Week8'' = Case When (a.taskDate = DateAdd(dd,49,@startingWeek)) Then hoursProposed Else 0 End,
''Week9'' = Case When (a.taskDate = DateAdd(dd,56,@startingWeek)) Then hoursProposed Else 0 End,
''Week10'' = Case When (a.taskDate = DateAdd(dd,63,@startingWeek)) Then hoursProposed Else 0 End,
''Week11'' = Case When (a.taskDate = DateAdd(dd,70,@startingWeek)) Then hoursProposed Else 0 End,
''Week12'' = Case When (a.taskDate = DateAdd(dd,77,@startingWeek)) Then hoursProposed Else 0 End
into #temp_hoursProposed
from td_projectsTasks a join #temp_projects b on a.projectid=b.projectid


select
distinct projectid, employeeId, isBillable, showUtilization,
sum(Week1) as Week1,
sum(Week2) as Week2,
sum(Week3) as Week3,
sum(Week4) as Week4,
sum(Week5) as Week5,
sum(Week6) as Week6,
sum(Week7) as Week7,
sum(Week8) as Week8,
sum(Week9) as Week9,
sum(Week10) as Week10,
sum(Week11) as Week11,
sum(Week12) as Week12
into #temp_hoursProposed2
from #temp_hoursProposed
group by projectid, employeeid, isBillable, showUtilization

select sum(a.week1) as week1, sum(a.week2) as week2, sum(a.week3) as week3, sum(a.week4) as week4, sum(a.week5) as week5, sum(a.week6) as week6,
sum(a.week7) as week7, sum(a.week8) as week8, sum(a.week9) as week9, sum(a.week10) as week10, sum(a.week11) as week11, sum(a.week12) as week12
from #temp_hoursProposed2 a
where employeeid =  @employeeID

drop table #temp_hoursProposed2
drop table #temp_projects
drop table #temp_hoursProposed
END


'
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_NonBillable_Utilization_Snapshot_Report]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'





I am using MySQL Administrator and understand how to actually setup the stored procedure, but I can't figure out how to modify the syntax. From what I can tell it is creating several temp tables, but I don't even see what/where the output value is.  I have spent a long time looking at this and any help would be appreciated. Thanks in advance!!
[+][-]01/17/08 04:59 PM, ID: 20687100Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/17/08 09:06 PM, ID: 20688154Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: MySQL Server, MS SQL Server, SQL Server 2005
Tags: MySQL
Sign Up Now!
Solution Provided By: mankowitz
Participating Experts: 2
Solution Grade: A
 
[+][-]01/17/08 09:06 PM, ID: 20688155Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/18/08 08:17 AM, ID: 20691509Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/08 07:49 AM, ID: 20706853Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628