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 |
|
blocker
Yak Posting Veteran
89 Posts |
Posted - 2010-04-14 : 00:15:18
|
| Good day.!I just want to ask a little help on how to return sql data by from date and to date filter with format(mm/dd/yyyy)in tbl_custtrans_detail in field transdate where cust_id=@cust_id.declare @fromdate as date, @todate as datedeclare @cust_id as varchar(10)This are the filter variables that holds the date being passed from stored procedures as well as the customerid.I also want to store the results in a variable array but i dont know how..Thank you for giving time. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-14 : 00:39:32
|
| [code]--your variable array to hold resultDECLARE @Results table (required columns....)INSERT INTO @ResultsSELECT columns... FROM tbl_custtrans_detail WHERE trans_date BETWEEN @fromdate AND @todate AND cust_id=@cust_id[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
blocker
Yak Posting Veteran
89 Posts |
Posted - 2010-04-14 : 00:57:21
|
| thank you.. is the table definition for the temporary repository of the result is already exist.? or the @Results table where table is the table name? Im just confused with the systax of the result table as coded belowDECLARE @Results table (([prodcode],[prodesc],[srp],[total]))is this the correct declararion.?Thank you very much... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-14 : 01:11:44
|
quote: Originally posted by blocker thank you.. is the table definition for the temporary repository of the result is already exist.? or the @Results table where table is the table name? Im just confused with the systax of the result table as coded belowDECLARE @Results table (([prodcode] int,[prodesc] varchar(100),[srp]...,[total]...))is this the correct declararion.?Thank you very much...
nope you need to include datatypes for fields as well just like you do for permanent tables------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
blocker
Yak Posting Veteran
89 Posts |
Posted - 2010-04-14 : 01:19:28
|
| I still cant get the correct format.. |
 |
|
|
blocker
Yak Posting Veteran
89 Posts |
Posted - 2010-04-14 : 01:30:55
|
| i got it.thank you very much.it works. I miss to put the correct data type.Thank you very much.. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-14 : 01:38:22
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|