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 |
|
satya068
Posting Yak Master
233 Posts |
Posted - 2010-03-17 : 18:39:22
|
| Hi..could anyone help in this query?In my database TABLE1 has 2 columns which contais all the table_names n row count in the database.these are all the sys.tables n sys.indexes table_names and row count inserted into TABLE1.Now i want to get a new column INSERT_DATE_COUNT>=sysdate() to all the tables in in TABLE1.INSERT_DATE_COUNT is nothing but count for INSERT_DATE column which already exists in all the tables in the same database.now my final table should exists TABLE_NAME,ROW_COUNT AND INSERT_DATE_COUNT.when i run the query i need all the count for insert_date>=sysdate().thnax for your helpSatyayashu |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-18 : 02:51:32
|
Execute this query and remove last union all from the result then execute the result you will get the table names with countSELECT 'SELECT ''' + Name + ''' [TableName], COUNT(*) [Count] FROM ' + Name + 'WHERE Insert_Date >= GETDATE() UNION ALL' FROM sys.tables this is what i understood. if any thing else let me know.Vaibhav T |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
satya068
Posting Yak Master
233 Posts |
Posted - 2010-03-18 : 04:38:52
|
| hi..ill try ur with that query.thanx for ur help. |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-18 : 05:09:41
|
| you are welcomeVaibhav T |
 |
|
|
|
|
|