for loop - select records from a table for each different date in single iteration of SQL query -


sorry vague problem statement, maybe not frame right way hence couldn't internet.

my basic intent select 2 columns table, table has been partitioned based on dates, , has huge number of records.

the intent select records each date jan 1 nov 30, can't using date between statement, need input each date separately in iteration in loop.

can writing dummy sql query on this?

thanks,

you can use scripting language iterate on each day achieve. below sample (untested code)

import pyodbc  conn = pyodbc.connect(dsn='dsnname',autocommit=true,ansi=true) cur = conn.cursor() sql = "insert tgt_table select col1,col2 src_table partitioned_date_column = date '2014-01-01' + interval '%d' day"  in range(1,30):     cur.execute(sql % i) 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -