Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Fixing a Date Value from flat file import into SQL via DataTable C#

$
0
0

I have a table which was created by importing a time card flat file from American Airlines. In the process the data values get messed up. The Flight Date is a string value. I need to fix the Flight data of ID 1060,1080,1090. They need to be all in January. SO: 1/24/2013, 1/25/2013,1/31/2013. This has to be accomplished by using any of the data in this table and some logic. Has to fixed any other dates that is issue occurs on such as 9/31/2013 for example which is 8/31/2013.

I actually put the data into a DataTable before I ever put it in to the SQL server. So the solution should be in C#

          ID

   FlightID

    UserID

   Flightdate

AirportCode

ReportTime

BlockInTime

TripNumber

SequenceNumber

1000

1

8503

1/13/2013

LAX

2254

613

5418

0

1020

1

8503

1/14/2013

MIA

1959

2243

5418

1

1060

3

8503

2/24/2013

LAX

1809

207

19165

0

1080

3

8503

2/25/2013

JFK

1541

1841

19165

1

1090

4

8503

    2/31/2013

LAX

2349

732

19167

0

1110

4

8503

2/1/2013

JFK

2219

121

19167

1

1120

5

8503

2/1/2013

LAX

2339

820

19167

0

1140

5

8503

2/2/2013

JFK

2129

4

19167

1

1150

6

8503

2/8/2013

LAX

2252

734

19412

0

1170

6

8503

2/9/2013

MIA

2007

2304

19412

1

1180

7

8503

2/2/2013

LAX

2347

715

19413

0

1200

7

8503

2/3/2013

MIA

2054

2351

19413

1

1210

8

8503

2/6/2013

LAX

2346

714

19413

0

1230

8

8503

2/7/2013

MIA

2053

2351

19413

1

1240

9

8503

2/20/2013

LAX

9

732

19413

0

1260

9

8503

2/20/2013

MIA

2156

102

19413

1

1270

10

8503

2/23/2013

LAX

3

750

19413

0

1290

10

8503

2/23/2013

MIA

2052

2359

19413

1

1300

11

8503

2/26/2013

LAX

2348

706

19413

0

1320

11

8503

2/27/2013

MIA

2109

20

19413

1























Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>