sql query in excel -
i have query parameters being fetched 2 cells in excell sheet, other 1 query is. so, problem opened data connection change query, since values it's returning wrong, , repplaced query. following:
declare @year int declare @month int declare @date datetime set @year = ? set @month = ? set @date = dateadd( month, 1, convert( datetime, convert( varchar(4), ?) + '-' + right( '0' + convert( varchar(2), ?), 2 ) + '-01' ) ) set @date = dateadd( month, 1, convert( datetime, convert( varchar(4), ? ) + '-' + right( '0' + convert( varchar(2), ? ), 2 ) + '-01' ) )
and expect fo parameter button highlited me costumize them , nothing. problem declaration itself?
later on, on query, things such date >=
declare @year int declare @month int declare @date datetime set @year = ? set @month = ? set @date = dateadd( month, 1, convert( datetime, convert( varchar(4), ?) + '-' + right( '0' + convert( varchar(2), ?), 2 ) + '-01' ) ) set @date = dateadd( month, 1, convert( datetime, convert( varchar(4), ? ) + '-' + right( '0' + convert( varchar(2), ? ), 2 ) + '-01' ) )
those parameters. there somthing wrong date declaration? have 2 dates, closure_date , begin_date , both of them accept year , month. parameters. how should 'query' them?
the
set @year = ? set @month = ?
looks wrong me - i'm not 100% sure might problem...
Comments
Post a Comment