July 20, 2012 at 3:31 pm
Hi guys,
How to identify the last inserted values in "select Query"
Example Query :
select * from iPROMIS_BI_FLOW_LINEUP where FLOW_LINEUP_NAME like '%2CUF%' order by FLOW_LINEUP_NAME asc
Thanks
Ranganathan palanisamy
July 20, 2012 at 3:37 pm
ranganathanmca (7/20/2012)
Hi guys,How to identify the last inserted values in "select Query"
Example Query :
select * from iPROMIS_BI_FLOW_LINEUP where FLOW_LINEUP_NAME like '%2CUF%' order by FLOW_LINEUP_NAME asc
Thanks
Ranganathan palanisamy
Not enough information to give you answer. If you have a DateCreated column, that would help. Also an identity column could be used, unless of course it were reseeded to a lower value. You could also look at other datetime columns, they may help identify the newest record in the result set.
July 20, 2012 at 3:44 pm
thanks for your anwser
please find the table structre
Column
FLOW_LINEUP_ID
FLOW_LINEUP_NAME
FLOW_LINEUP_DESC
METER_ID
FLOW_LINEUP_ACT_CALCNAME_ID
FLOW_LINEUP_ACTUAL_CALCTYPE
SIMTO_TAG_ID
FLOW_LINEUP_SIMTO_CALCNAME_ID
FLOW_LINEUP_PLAN_CALCTYPE
FLOW_LINEUP_FLAG
FLOW_LINEUP_CR_DT
FLOW_LINEUP_MD_DT
FLOW_ID
datatype :
int
varchar
varchar
int
int
char
int
int
char
varchar
datetime
datetime
int
July 20, 2012 at 3:49 pm
ranganathanmca (7/20/2012)
thanks for your anwserplease find the table structre
Column
FLOW_LINEUP_ID
FLOW_LINEUP_NAME
FLOW_LINEUP_DESC
METER_ID
FLOW_LINEUP_ACT_CALCNAME_ID
FLOW_LINEUP_ACTUAL_CALCTYPE
SIMTO_TAG_ID
FLOW_LINEUP_SIMTO_CALCNAME_ID
FLOW_LINEUP_PLAN_CALCTYPE
FLOW_LINEUP_FLAG
FLOW_LINEUP_CR_DT
FLOW_LINEUP_MD_DT
FLOW_ID
datatype :
int
varchar
varchar
int
int
char
int
int
char
varchar
datetime
datetime
int
Doesn't tell me a thing. I don't know what the table is nor do I know what or how the data gets into the table. These are things you know and you need to use that knowledge to determine what the answer to your question happens to be.
A guess would be one of these two columns:
FLOW_LINEUP_CR_DT
FLOW_LINEUP_MD_DT
July 20, 2012 at 3:53 pm
sorry it my mistake not mention column desciption,
FLOW_LINEUP_CR_DT -> while insert datetime
FLOW_LINEUP_MD_DT --> Modified insert datetime
Thanks for you reply...
Thanks
Ranganathan palanisamy
July 20, 2012 at 3:54 pm
Looks to me that you have enough information to answer your own question at this time.
July 20, 2012 at 4:16 pm
Thanks for your support
i found the solution
find below query
select MAX(FLOW_LINEUP_NAME) from iPROMIS_BI_FLOW_LINEUP where FLOW_LINEUP_NAME like '%2CUF%'
July 22, 2012 at 2:36 am
OUPUT Clause after a dml statement also gives the latest updated/inserted/deleted rows. Check this link for more details:
msdn.microsoft.com/en-us/library/ms177564.aspx
Lokesh
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
July 22, 2012 at 3:55 pm
lokeshvij (7/22/2012)
OUPUT Clause after a dml statement also gives the latest updated/inserted/deleted rows. Check this link for more details:msdn.microsoft.com/en-us/library/ms177564.aspx
Lokesh
True enough but that won't work if you're trying to find the "last inserted" rows after the fact.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 22, 2012 at 3:59 pm
ranganathanmca (7/20/2012)
Thanks for your supporti found the solution
find below query
select MAX(FLOW_LINEUP_NAME) from iPROMIS_BI_FLOW_LINEUP where FLOW_LINEUP_NAME like '%2CUF%'
How does a name like FLOW_LINEUP_NAME identify the "last inserted" information? Is the name based on a date or something similar?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply