Ok I am tying to convert access syntax to Sql syntax to put it in a stored procedure or view..
Here is the part that I need to convert:
SELECT [2007_hours].proj_name, [2007_hours].task_name, [2007_hours].Employee,
IIf(Mid([task_name],1,3)='PTO','PT O_Holiday',
IIf(Mid([task_name],1,7)='Holiday' ,'PTO_Holiday',
IIf(Mid([proj_name],1,9) In ('9900-2831','9900-2788'),'II Internal',
IIf(Mid([proj_name],1,9)='9900-2787','Sales',
IIf(Mid([proj_name],1,9)='9910-2799','Sales',
IIf(Mid([proj_name],1,9)='9920-2791','Sales',
)
)
)
)
) AS timeType, Sum([2007_hours].Hours) AS SumOfHours
Here is what i am trying to do:
select case
when SUBSTRING(task_ name, 1, 3)= 'PTO'
then Replace(task_na me,'PTO','PTO_H oliday') and Sum(td_hours) AS SumOfHours (this will give me an error)
when SUBSTRING(task_ name, 1, 7)= 'Holiday' and SUBSTRING(task_ name, 1, 3)= 'PTO'
then Replace(task_na me,'Holiday','P TO_Holiday')and Sum(td_hours) AS SumOfHours (this will give me an error)
ELSE task_name
This does not work i can't have two things happening after "Then"
thanks
0 1027 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: wiredog |
last post by:
I am struggling rewriting my query from MS Access' IIF, Then to SQL
Servers TSQL language. I am hoping some one can give me some
guidance. I believe I have the first portion of the query correct but
do believe this requires a "NESTED" argument. This is where I am
lost.
My Original MS ACCESS Query reads--
SELECT DISTINCTROW REGION_TRAFIC.*,
IIf(Mid(,5,2)=,
|
by: Terry Bell |
last post by:
I'm upsizing an Access database. Got the data converted, working on
the front end, converting queries to views, but having trouble
converting queries that use logical expressions like the following:
SELECT OrderId,
Sum((BackOrderQtyAvailable>0)*-1) AS ReadyBackOrderItems
FROM OrderDetails
INNER JOIN Items
ON (OrderDetails.ClientId = Items.ClientId)
AND (OrderDetails.ItemId = Items.ItemId)
WHERE (NOT (SitesCustomerTypeId = 2
|
by: Dana Shields |
last post by:
I am attempting to upsize from access to SQL Server. I'm trying to convert
my queries to SQL Server views; however, I'm having a lot of difficulty with
the syntax differences.
For instance, a query with select mid(tblTable.FieldName,1,10)should look
something like select substring(tblTable.FieldName,1,10).
This is really the simplest of examples. I've tried using the SQL Server
Import tool, but it takes the queries and changes them...
|
by: 17028 |
last post by:
Hi all,
I've got this macro that I run to synch two forms. As part of that
synch, I have to set all instances belonging to the current customer
record in an associated table called tblDomains.
This was how I did it in Access/JET:
UPDATE tblDomains SET Primary = False WHERE CustomerID =
Forms!frmCustomers!CustomerID
|
by: Frederik Vanderhaeghe |
last post by:
Hi,
I have a problem converting text to a double. Why doesn't the code work:
If Not (txtdocbedrag.Text = "") Then
Select Case ddlBedrag.SelectedIndex
Case 0
Case 1
| |
by: sparks |
last post by:
When I converted a database yesterday I noticed one little thing I had
not seen before.
Any fields on the forms that were visible=no became visible = yes
after the conversion..
Is there any other little things like this that come up that I have
not thought of?
thank you for any info about this
|
by: Chris Asaipillai |
last post by:
Hi there
My compay has a number of Visual Basic 6 applications which are front endeed onto
either SQL Server or Microsoft Access databases.
Now we are in process of planning to re-write these applications into Visual Basic.Net.
My managers main thought is that Visual Basic 6 is (or has!) stopped being supported
by Microsoft.
|
by: rob41 |
last post by:
I'm in the process of converting numerous queries from access 07 to sql server 05 to improve runtime performance. Below is a sample of code and the error I'm getting.
INSERT INTO
( , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , )
SELECT ., ., ., LTrim(.) AS Expr1, LTrim(.) AS , LTrim(.) AS , LTrim(.) AS , LTrim(.) AS , LTrim(.) AS , LTrim(.) AS , LTrim(.) AS , LTrim(.) AS ,...
|
by: Anthony97 |
last post by:
This is a problem I've been fighting through for the last month. I've been tasked with converting access 2007 queries to SQL Server 2005. I have been able to convert a number of queries associated with one data base now I'm running into problems with IIf. I've looked at the books online and tried to debug the query I'm working on now. This query will be a model for other queries moving forward. Has anyone had success working with IIf and...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |