Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
MikeB
Constraint Violating Yak Guru
387 Posts |
Posted - 2002-07-11 : 10:39:40
|
I have a table:ProjectNum | MarkNum | ShipDate | Stack | Level | Position ProjectNum, MarkNum are Text fields.ShipDate is DATE field.Stack, Level, Position are Number (integer) fields.There can be more then one record with the same ProjectNum, MarkNum, and ShipDate. I insert the record with this information first then later in the application the Stack, Level, and Position are set.What I need to do is get 1 record from this table using a select statment similar to:"SELECT ??1?? FROM ShippingLoadTable WHERE ProjectNumber = '%s' AND MarkNumber = '%s' AND Stack IS NULL" I tried the above statment using TOP 1, but this did not work. Could someone instruct me on what to do/ what I am doing wrong!Mike BEdited by - MikeB on 07/11/2002 10:42:04 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-07-11 : 13:15:36
|
I think I know what you are going for, but I think i need more details to solve it.Can you give example INSERT statements that would insert the records, and then give a sample of what you want the records to look like once your done with them?Here's what I "think" you haveInsert 3 recordsupdate the "first record" with stack 0, level 0, position 0update the "second record" with stack 0, level 1, position 1update the "third record" with stack 0, level 2, position 3Something like that?Michael<Yoda>Use the Search page you must. Find the answer you will. |
 |
|
MikeB
Constraint Violating Yak Guru
387 Posts |
Posted - 2002-07-11 : 16:10:55
|
Thank you very much for you reply. I have resolved the issue at hand using the following select statement:"SELECT Top 1 * FROM ShippingLoadTable WHERE ShippingDate = #%s# AND ProjectNumber = '%s' AND MarkNumber = '%s' AND Stack = 0 ORDER BY ShippingDate DESC" FYI the insert statement I use is the following"INSERT INTO ShippingLoadTable ([ShippingDate], [LoadNumber],[ ProjectNumber], [MarkNumber]) VALUES ('%s', %d, '%s', '%s')", .... variables go here I insert the record and later set its position fields. I do this using the select statement about and then by setting each field value. I would show more code but I am using c++ and ADO as a front end and all the classes are my own wrapper classes for ADO making the functions look foreign to others. ;)Mike B |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-07-11 : 16:14:24
|
Ahh Access dates, I missed the fact that this was an Access Question.Well glad you got it resolved.Michael<Yoda>Use the Search page you must. Find the answer you will. |
 |
|
|
|
|
|
|