Convert From Access Query To MS SQL View

Oct 21, 2005

Hi folks,

I have a query which pulls together several other queries. It works fine in Access but I also need it to work on a MS SQL server.

the SQL is as follows;

SELECT Client.ClientName, Entity.EntityName, IIf([101].[ProductID] IS NULL, [-], [X]) AS TA, IIf([301].[ProductID] IS NULL, [-], [X]) AS TR, IIf([302].[ProductID] IS NULL,
[-], [X]) AS CU, IIf([304].[ProductID] IS NULL, [-], [X]) AS TC, IIf([502].[ProductID] IS NULL, [-], [X]) AS FA, IIf([503].[ProductID] IS NULL, [-], [X]) AS MO
FROM Client LEFT JOIN
Entity ON Client.ClientID = Entity.ClientID LEFT JOIN
VIEW_PROD301 AS 301 ON Entity.EntityID = [301].EntityID LEFT JOIN
VIEW_PROD302 AS 302 ON Entity.EntityID = [302].EntityID LEFT JOIN
VIEW_PROD304 AS 304 ON Entity.EntityID = [304].EntityID LEFT JOIN
VIEW_PROD502 AS 502 ON Entity.EntityID = [502].EntityID LEFT JOIN
VIEW_PROD503 AS 503 ON Entity.EntityID = [503].EntityID LEFT JOIN
VIEW_PROD101 AS 101 ON Entity.EntityID = [101].EntityID;

The problem seems to be with the iif statement.

Any ideas how I can gt around this?

Thanks,

Dave

View Replies


ADVERTISEMENT

Unable To Convert A Large File Into Ascending View?

Jul 2, 2014

The file was converted from excel. It is in Datasheet view. I select the first column and clip on the Ascending choice under the Home Tab. It works but leaves a large gab of blank rows. I go to the Database Tools tab and check Compact and Repair Database. The file returns to the original unorganized list.

View 1 Replies View Related

Convert And Sql Query To Access

Sep 15, 2007

someone wrote this query for me in SQL and there is one part of it I don't understand can someone tell me how to convert this line for access? I don't know what || is

TO_NUMBER(SUBSTR(TO_CHAR(WE.mth_welfare),5,2) ||
SUBSTR(TO_CHAR(WE.mth_welfare),1,4)) an_mth_welfare


SELECT
WE.mth_welfare,
WE.id_case_welfare,
WE.id_case,
OB.id_member,
SUM(WE.amt_mtd_assist_expnd),
SUM(WE.amt_ltd_assist_expnd),
SUM(WE.amt_ltd_assist_recoup),
TO_NUMBER(SUBSTR(TO_CHAR(WE.mth_welfare),5,2) ||
SUBSTR(TO_CHAR(WE.mth_welfare),1,4)) an_mth_welfare
FROM noldba.welfare_balance_by_obligation WE, noldba.obligation OB
WHERE WE.id_case = OB.id_case
AND WE.seq_order = OB.seq_order
AND WE.seq_obligation = OB.seq_obligation

AND WE.mth_welfare <= 200708
AND WE.dt_END_validity = '31-DEC-9999'
AND WE.dt_end_validity = OB.dt_end_validity
AND OB.dt_beg_obligation = (SELECT MAX(c.dt_beg_obligation)
FROM noldba.obligation c
WHERE c.id_case = ob.id_Case
AND c.seq_order = ob.seq_order
AND c.seq_obligation = ob.seq_obligation
AND c.dt_end_validity = '31-DEC-9999')
GROUP BY WE.id_Case, OB.id_member, WE.id_case_welfare, WE.mth_welfare
ORDER BY WE.mth_welfare DESC,
WE.id_case DESC,
OB.id_member DESC;

View 3 Replies View Related

Convert SQL Query To Access

Dec 18, 2007

I have this query which I use with a program called "Query Reporter" - it runs well and gives me the correct answers.
Select COUNT (b.case_id),
sum(a.amt_to_distribute) Held_amt,
iv_d_do_code,
cd_reason_status--HELD REASONS-DH-DIST,NX-NO OBL,XS-EXCESS OBL,MW-MANU WKR,HM-NO MHIS,CC-CLOSED
From vrcth a, vcase b
Where A.Cd_Status_Receipt = 'H'
And A.Dt_Distribute = '01-JAN-0001'
And A.Dt_End_Validity = '31-DEC-9999'
AND Not Exists (Select 1 from vrcth k -- Checking receipt is not backed out
where a.dt_batch = k.dt_batch
ANd a.no_batch = k.no_batch
And a.cd_source_batch = k.cd_source_batch
And a.seq_receipt = k.seq_receipt
And k.ind_backout = 'Y'
And k.dt_end_validity = '31-DEC-9999')
And ((trim(A.Id_Case) IS NOT NULL -- When receipt is case identified
AND A.Id_case = b.case_id )
Or
( trim(A.Id_Case) IS NULL -- When receipt is payor identified
ANd b.case_id = (Select Min(y.case_id) from vcase Y, vcmem Z
Where A.Id_Payor = z.member_id
And z.relation_code IN ('A','P')
And z.case_id = y.case_id )
))
group by iv_d_do_code,
cd_reason_status
order by iv_d_do_code;

What I want to do is to rewrite the query in Access and get the same results. This is what I came up with which is returning nothing. Would someone please give the two of them a look and tell me what I'm missing the in Access query. Thanks

SELECT Count(b.CASE_ID) AS CountOfCASE_ID, Sum(a.AMT_TO_DISTRIBUTE) AS Held_amt, b.IV_D_DO_CODE, a.CD_REASON_STATUS
FROM NOLDBA_RECEIPT AS a, NOLDBA_INT_CASE_STATUS AS b
WHERE (((Trim([a].[id_case])) Is Not Null) AND ((a.ID_CASE)=[b].[case_id]) AND ((a.CD_STATUS_RECEIPT)='H') AND ((a.DT_DISTRIBUTE)=#1/1/2001#) AND ((a.DT_END_VALIDITY)=#12/31/9999#) AND ((Exists (select 1 from NOLDBA_RECEIPT k
where a.dt_batch=k.dt_batch
and a.no_batch=k.no_batch
and a.cd_source_batch=k.cd_source_batch
and a.seq_receipt=k.seq_receipt
and k.ind_backout ='Y'
and k.dt_end_validity =#12/31/9999#))=False)) OR (((Trim([a].[id_case])) Is Null) AND ((a.CD_STATUS_RECEIPT)='H') AND ((a.DT_DISTRIBUTE)=#1/1/2001#) AND ((a.DT_END_VALIDITY)=#12/31/9999#) AND ((Exists (select 1 from NOLDBA_RECEIPT k
where a.dt_batch=k.dt_batch
and a.no_batch=k.no_batch
and a.cd_source_batch=k.cd_source_batch
and a.seq_receipt=k.seq_receipt
and k.ind_backout ='Y'
and k.dt_end_validity =#12/31/9999#))=False) AND ((b.CASE_ID)=(select min (y.case_id) from NOLDBA_INT_CASE_STATUS Y, NOLDBA_INT_CASE_MEMBER Z
WHERE A.ID_PAYOR=Z.MEMBER_ID
AND Z.RELATION_CODE IN ('A','P')
AND Z.CASE_ID=Y.CASE_ID)))
GROUP BY b.IV_D_DO_CODE, a.CD_REASON_STATUS
ORDER BY b.IV_D_DO_CODE;

View 3 Replies View Related

Trying To Convert SQL Query To Access, Don't Know Where To Start

Jul 12, 2005

I just started working for a company the other week and they threw this query onto my lap with an unrealistic deadline. My programming experience is primarily in VB6, so I am not completely familiar with coding Access queries.

I was given code that was written for SQL, and the programmer that came up with it is unfamiliar with Access, so I am stuck trying to decipher this. If anyone could help me out, I would greatly appreciate it, as I am thoroughly confused and don't know where to begin. Here is the programmer's original code:
while exists(select top 1 accNum from NoteFile where patindex('%' + char(10) + '%',dbtrref) > 0)
begin
--Insert note into table
insert into #TL19Note(AcctNumber, Note)
select accNum, (case when patindex('%' + char(10) + '%',
dbtrref) <= 0 then dbtrref else left(dbtrref,patindex('%' + char(10) +
'%',dbtrref)) end)
from NoteFile

--Delete note from Note String
update NoteFile
set dbtrref = right(dbtrref,len(dbtrref)-len(left(dbtrref,patindex('%' + char(10) + '%',dbtrref))))
where len(dbtrref)-len(left(dbtrref,patindex('%' + char(10) +'%',dbtrref))) > 0

--Delete rows with no more notes
delete from NoteFile
where len(dbtrref)-len(left(dbtrref,patindex('%' + char(10) +'%',dbtrref))) <= 0 or patindex('%' +char(10) + '%',dbtrref) <= 0
end

--Eliminates any that are CRLR or just spaces
delete from #TL19Note
where len(Note) < 10

--Update the date
update #TL19Note
set NoteDate =left(Note,patindex('% %',Note)-1),
Note = right(Note,len(Note)-patindex('% %',Note))

--No '@' means no time?
update #TL19Note
set NoteTime = '0000'
where left(Note,1) <> '@'

--delete the '@' - we know which ones have it because NoteTime is null
update #TL19Note
set Note = right(Note,len(Note)-patindex('% %',Note))
where left(Note,1) = '@'

--Update NoteTime, take time out of note
update #TL19Note
set NoteTime = left(Note,2) + substring(note,4,2),
Note = right(Note,len(Note)-patindex('% %',Note))

View 6 Replies View Related

Help CONVERT Access PIVOT QUERY To SQL SERVER

Oct 22, 2007

Can anyone help me convert this pivot query to work in sql server please?
I'll love you forever if you help me please :pTRANSFORM Count(Employees.MaritalStatus) AS MaritalStatusCount
SELECT Employees.MaritalStatus
FROM Employees INNER JOIN Offices ON Employees.OfficeId = Offices.officeId
WHERE ((Not (Employees.MaritalStatus) Is Null))
GROUP BY Employees.MaritalStatus
PIVOT Offices.officeLocation;

View 2 Replies View Related

How To Convert Number Date To Text In Access Query

Feb 12, 2015

how to convert number date to text date.

Ex. Date field: 02/12/2015

convert into:

Month field
February

Day Field
12

Year
2015

View 3 Replies View Related

Queries :: Convert String Back To Hyperlink In Access Query From SQL Table?

Nov 10, 2014

I am in the process of building a new database in SQL to replace my MS Access database. However, I will continue to use the Access forms, queries, and reports. The new tables will house much of the same data. In multiple tables I have hyperlinks that were created and added in the original Access tables. To import these hyperlinks into the new SQL tables I have converted them to 'Long Text' before exporting, thus changing them into strings.

For example:

Hyperlink - Email - Add Additional Mailbox to Outlook (2010) has been changed to:

Email - Add Additional Mailbox to Outlook (2010)#ServernameServerfolderDocumentationRea dy to GoOutlook TemplatesEmail - Add Additional Mailbox to Outlook (2010).oft#

The obvious issue that I am running into is that after the SQL database table has been linked to the Access database it still displays the entire string when I open the table. The form has a textbox and search button that is used as a search function. This runs a query that returns all "search results" for the desired information. Is there a way that the query can convert the string back into a hyperlink so that the query displays just Email - Add Additional Mailbox to Outlook (2010) as a hyperlink and not the entire string?

View 1 Replies View Related

Forms :: Unable To View Object Properties In Form Design View (Access 2010)

May 16, 2014

Why the ability to view the properties of an object within a form is not available when you double click on it in design view?

I was happily working away double clicking on a command button to edit some code when for some reason the next time I tried to edit it did not open up for me.

I was unable to access it even by right clicking on the object & selecting properties as that also appears to be disabled, not greyed out or anything but just does nothing when selected.

Have I inadvertently changed a setting somewhere that prevents the properties from being displayed?

View 3 Replies View Related

I Have A Sql Query Pls Convert It To Ms Access Query

Mar 12, 2007

I have made this query in ms sql it works fine as per my needs iam getting the values but this doesn work in ms access 2002 can someone work this out its lil urgent tested out a lot of things but better to give the best people's n get their knowledge...

SELECT wc.windowsname FROM windowsconductivity as wc join constructiondetailes as cd on wc.windowsid=cd.materialid join uvalueconstruction as uc on uc.constructionid=cd.constructionid join projectmasterwindows as pmw on pmw.windowconstruction=uc.constructionname WHERE pmw.projectname='new8thmarch07' and pmw.windowconstruction='new8thmarch' and uc.constructiontype='windows' order by cd.constructiondetailsid

thanks aton...

View 7 Replies View Related

Access Won't Load Query When Trying To View

Nov 25, 2011

I'm currently using access to try and link together a number of different databases into one. These databases are exported from an internal system we use and outputs in Excel format.

When these export there is one large database which has about 25 columns and about 3000 rows. The other information that exports are much smaller databases which link to the rows of information in the larger database and for a mail merge to work I need them all to be merged in single rows.

I've linked the main database with all of the separate smaller databases in Access so that I can run the query to combine them all together. However, when I try and run this query or view it Access appears to be loading but never does actually load. I assume it's timing out. I left it running overnight and the problem still persisted.

I assume it's a RAM issue, or maybe disk space or hard drive. The file size of the Access project is about 17mb, so not ridiculously big, but the computer I am using is quite outdated. Is the query likely to work with a better computer, or does Access have certain limitations for larger queries? With all the rows and columns merged with the separate database there is likely to be 3000 rows and about 100 columns. Is this too large for Access to run?

View 5 Replies View Related

How Do View The Data Types Returned By A Query In Access 2000?

Jun 3, 2005

I am working in MS Access 2000. I have a query that is returning a table with various types of data. The problem is I can't seem to find anywhere in the Access GUI that will show me the data types of columns it has returned so I can't manually create a table to hold the values returned by query. Question is two fold:

1. Is there a way in Access SQL to import data returned from a query into a table that is not yet defined. Some like this:
a. Create a table that has a primary key but doesn't yet know the number of columns and/or data types of those columns.
b. Import the data from a query into this table and have it create the columns and copy the data types and populate the table while also numbering each row by primary key.

or
2. Is there a way to find out what the data types are for a table returned by a query in MS Access. I have checked the properites of the query and have been up and down the gui looking but I can't find a way while looking at the data returned by a query to explicitely see the data type (i.e., number, Date/Time, etc..) used by each column.

Any info would help. Thanks.

View 1 Replies View Related

Queries :: Access Freezes When Switching To Design View In Open Query

Jul 22, 2013

My issue is that one of my queries can be run, opened in SQL view, but not opened in design view. When I attempt to view in design view, Access freezes and I am forced to close the program. My database is split, FE on my local, BE on another computer on my LAN.

Below is the SQL, I tried to just copy and paste this code into a new query and I encountered the same issue.

Code:
SELECT tbl_SurveyJobs.job_number, tbl_JobTypes.job_type_description, tbl_Clients.company_name, tbl_SurveyJobs.start_date, tbl_SurveyJobs.end_date, tbl_SurveyJobs.comments, tbl_SurveyJobs.contact_notes, tbl_SurveyJobs.regplan_number, tbl_SurveyJobs.sheet_number, tbl_SurveyJobs.mplan_number, tbl_SurveyJobs.lot_block, tbl_SurveyJobs.township, tbl_SurveyJobs.concession, tbl_SurveyJobs.township_lot,

[Code] .....

View 2 Replies View Related

Queries :: Create Update Query To Budget Table Using Access Design View?

Feb 17, 2015

trying to create an update query to Budget table using the Access Design View:

Field: PctSls (in tblBudget) Update to: [Expense] / [Sales]. The update query always returns 0. However, if I create a Select query using the same calculation, the correct results is displayed. PctSls is defined in the Budget table.

I haven't worked with Access (2003) for several years but this seems too simple to be causing me such frustration. (Was only a casual user even then).

View 6 Replies View Related

Convert Access 2000 Database To Access 2003

Sep 27, 2006

Hi,

A few years ago I’ve made an access database on access 2000. The problem is that now I’ve installed the office 2003, and I can’t make the database work properly.

At first says that are missing those files: “tshoot.ocx”, “msioff9.ocx” and “msowc.dll”; so, I’ve copy them from another computer using office 2000 and now only complains about “msioff9.ocx” saying that my database contains a reference incomplete to it.

Is there no other way to convert my database do work properly with access 2003? What can I do?

Regards

View 2 Replies View Related

Design View Keyboard Shortcut - Expand Columns In Design View Of A Query

Jun 5, 2014

I'm looking for a keyboard shortcut to expand the columns in "design view" of a query.

What I mean by this is rather than selecting all of the columns and double clicking to see the entire text, I'd like to be able to a shortcut.

The entire process as I see it involves 3 steps so I will need thesolution to the 3rd step.

(1) [ctrl+spacebar] to select initial column
(2) [shift+arrows] to select all of the columns I need
(3) [keyboard shortcut] will expand all of the columns "field" names to the size of the column heading

Alternatively, if you know of a shortcut that will expand the columns without having to select them first I'll take it!!

View 4 Replies View Related

Convert Access

Feb 16, 2008

Hello

It been a while since i have been on the forum. I developed a database last year and since then i have moved to a MAC.

I would like to know if there is a quick and easy way of converting a database to application which works on any PC or MAC which does not have access?

View 2 Replies View Related

Convert Access To Web

Mar 11, 2005

Can anyone tell me the best and easiest way to convert an
existing ms access database to run on the web.

I am just a beginner at this so please tell me in simple terms.

thanks

View 1 Replies View Related

SQL Command Convert Into Access

Dec 15, 2011

select Saler, Model, Price, DDate
from DB_Table where DDate in

(select max(DDate) from DB_Table where Valid = 'ok' group by Saler, Model)

How can I make it work in ms access 2007? I am trying to get valid (ok) price for Saler-Model group at max date.

View 4 Replies View Related

Please Help Me Convert Access 2003 Db To 2000

Aug 24, 2005

It's not letting me open it since i did it in 2003, and im trying to open it now at home in 2000.
I'd really appreciate if anyone can help me convert it and then attach it...thanks :o

View 3 Replies View Related

Convert UNIX Time To MS Access

Jan 22, 2006

Hello everyone

I’m trying to find a way to convert a UNIX timestamp to the standers universal timestamp. At this point I can’t even make sense of the UNIX time stamping system.

I would like to be able to use Microsoft access to do the conversion.

Does anyone one a why to convert the UNIX timestamp into a MMDDYY formatted time. Any help would be greatly appreciated


Thanks

Corey

View 1 Replies View Related

Convert Access Database To Spanish

Dec 29, 2006

I have a request to convert a Microsoft Access 2000 database from english to spanish. Can this be done easily?

View 1 Replies View Related

Convert From Access 2003 To 2007

Dec 29, 2007

all my access 2003 project stoped working. i have massage that missing file DTE.OLB.

View 2 Replies View Related

Convert Excel Formula For Use In Access

Feb 14, 2008

I have an excel worksheet with the following formula

=IF(b40<50000,b40*0%,IF(b40<100000,b40*2.5%,b40*5%))

and I would like to convert it for use in access.

I came up with the following:

=iif([TOTAL]<50000,[TOTAL]*0%,IIF([TOTAL]<100000,[TOTAL]*2.5%,[TOTAL]*5%))

I get the following error: "The expression you entered contains invalid syntax.

You omitted an operand or operator, you entered an invalid character or comma, or you entered text without surrounding it with quotation marks."

I am probably missing something very simple here, but I have been unable to come up with a solution.

Any help would be greatly appreciated.

Regards,

Michael

View 3 Replies View Related

Queries :: How To Convert Not In Part In Access SQL

Feb 11, 2014

I have a sql server query that I need to use in access 2003 but I can not figure out how to convert the "not in" part of the query. Here is the sql server query

Select * from accounts where beg_date between '1/1/2013' and '12/31/2013' and cast(acctNo,integer) in (2,3,4,5,7,12,20) and acct_type not in ('Individual','User','Viewer')

I can not find how to do the "not in" in access sql.

View 7 Replies View Related

Convert Access 97 Mde To Access 2000

Apr 3, 2006

I have a client that has a access 97 mdb file as a backend and access 97 mde front end.

The problem is that they don't have the mdb file for the front end and they want me to convert it to 2000.

Is there software that can convert the 97 mde file to 2000 mde/mdb? If I try to import the queries, reports and forms it only allows me to import the queries.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved