Käynnissä

MS SQL 2008 Recursive Query

I have an [url removed, login to view] 4.0 application that uses an SQL 2008 database with a table called PERMIT. This Permit table has several fields but the fields of concern are

MCDNUM (FLOAT) (The permit number)

REPLACED (NVARCHAR) (Replaced this permit by another permit#)

OLD (NVARCHAR) (What the old permit number was before this one replaced it)

DATEISSUED (DATE) The date permit was issued

I prefer that you construct and test your own database rather than try to populate with my data. My data has under 5000 records but is sensitive.

The MCDNUM is a permit number. When the permit is renewed it is given a new number (A new record in the database) and then it REPLACED field gets entered this new MCDNUM. The new permit record gets the OLD the the MCDNUM from the "old" permit. It is possible that a permit is renewed and there are multiple new permits from it. When this happens the old permit number can only hold one number but the new MCDNUMS can have the same "OLD" MCDNUM So for example:

MCDNUM REPLACED OLD

---------------------------------------

100 200

200 100

250 300

300 400 250

400 300

500 400

600 1000 400

700 400

1000 600

What i need is a query or mixture of a stored procedure that will allow me to enter an MCDNUM that will recursively look up ALL the associated record's MCDNUM and the DATEISSUED in the order of DATEISSUED

So if I were to search for MCDNUM 100 It would find 100 and 200

It has to search up and down in both the REPLACED and OLD fields and all of those records (REPLACED and OLD) fields. So if I searched 1000, I would get 600, 400, 300, 250

I think the results need to go into an array maybe? so that the same MCDNUMS are not duplicated as the final results will be a record set with the following:

MCDNUM, REPLACED, OLD, DATEISSUED order by the DateIssued field

I want error correction in case one of the fields is null or has an invalid data. Ultimately I will need the results of this query in a Gridview that will look at a URL parameter called MCDNUM which will plug in the search requirement number. So I am open to any suggestions or workflow.

Taidot: .NET, C# -ohjelmointi, SQL

Näytä lisää: final results, sql get date, recursively, recursive query, recursive, query table, sql final, sql search asp, workflow 2013, sql maybe, asp sql search, gridview database, 2013 query, open recursive, sql test number, 600 records, error correction asp, 100 600 700, mcdnum, 300 array example, sql query field, 300 array, sql query find date, array 300, net search stored procedure

About the Employer:
( 100 reviews ) United States

Projektin tunnus: #4263628

Myönnetty käyttäjälle:

wizziewizard

Went through the requirements. Please view your PMB.

30 $ USD 1 päivässä
(8 arvostelua)
4.5

13 freelanceria on tarjonnut keskimäärin 85 $ tähän työhön

customizedata

Please have a look at pm...

120 $ USD 2 päivässä
(75 arvostelua)
5.5
cheapexcell

Ready to start.

50 $ USD 1 päivässä
(31 arvostelua)
4.4
krishnadubey

hello, i'll be happy to create it in a day. regards, krishna

50 $ USD 1 päivässä
(7 arvostelua)
3.1
MitaBhuva

Hello, We are ready for that job. Please check Private Message. Thanks & Regards Tera Technolabs

80 $ USD 2 päivässä
(1 arvostelu)
1.2
chetanchauhan87

.Net, SQL experts here.Please see PM

80 $ USD 5 päivässä
(1 arvostelu)
1.2
livioalves

I work with software development since 1994, these years I have worked developing, coordinating and managing the development of applications: Client / Server, Web, embedded applications, bulk copy software, monitoring Lisää

200 $ USD 2 päivässä
(0 arvostelua)
0.0
RayzInfotech2012

Hi there, I would like to express my interest to your ad post in Freelancer.Let it be known that although that I have zero work hours here.I am hardworking and industrious. I will guarantee timely delivery of your p Lisää

75 $ USD 1 päivässä
(0 arvostelua)
0.0
celeronpm

Hello, we have expert Microsoft certified SQL developers and DBA's that can create the query you are seeking with an incredible turnaround time.

100 $ USD 1 päivässä
(0 arvostelua)
0.0
yasminarafat

I am expert in SQL

35 $ USD 4 päivässä
(0 arvostelua)
0.0
urfreelance

Ready to start.

30 $ USD 1 päivässä
(0 arvostelua)
0.0
vw8066658vw

I am an asp.net(classic) developer working with ms sql server 2008 on a daily basis for almost 2 years already. I know exactly how this should be done. Please check pm.

50 $ USD 2 päivässä
(0 arvostelua)
0.0
sergiogonzalez84

That's easy I think I can do it in record time of 24 hours.

200 $ USD 5 päivässä
(0 arvostelua)
0.0