Tuesday, March 27, 2012
Create a table with a field with only Time datatype
I want to create a table to store only time in a fileld. There is "DateTime" for my purpose but i dont want to save the Date part only the time part as "12:30:44 AM". I know i can select only time part from Datetime field but i want to save only time.Can anybody help me how can i create that kinda table ?Hello experts,
I want to create a table to store only time in a fileld. There is "DateTime" for my purpose but i dont want to save the Date part only the time part as "12:30:44 AM". I know i can select only time part from Datetime field but i want to save only time.Can anybody help me how can i create that kinda table ?
See this enigma's post link (http://sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk)
Its a good one ...|||i dont understand why you are not thinking in terms of a datetime/smalldatetime field by ignoring the date part and whats wrong in it. however, if you are rigid you can store it either as char field or as numeric field (float/decimal). remember you do not actually save anything by doing so.
storing as char field is straight forward. if you want to store as number (remember that each date+time has a numeric representation) can take hints from the following queries
--1 minute as number
select cast(cast('20060101 11:01 AM' as smalldatetime) as float)- cast(cast('20060101 11:00 AM' as smalldatetime) as float)
--it returns approx 0.0006944
--use that to get a date time 20060101 11:00 AM back
select cast( cast(cast('20060101' as smalldatetime) as float) + (0.0006944*60*11) as smalldatetime)
quite unnecessary...;-)sql
Sunday, March 25, 2012
Create a PDF file directly to disk?
Hello all,
I use Reporting Services and an aspx page to create a PDF file. I need to save the file directly to a disk file with a name, without asking the user if he want to open or to save it. I'm using the folowing command:
Response.WriteFile("http://" & System.Environment.MachineName & "/ReportServer?%2fReportsApp%2fRptFSUnicoR&rs%3aCommand=Render&rs%3aFormat=PDF&MyID=" & IDFun,True)
Any idea how I do that?
Regards
HttpResponse.WriteFile requires either an absolute or virtual path to a sever-local filesystem location. So, referencing the URL of the report server won't work.
Also, I don't think you'll be able to bypass any browser's download prompt dialog without employing some sort of trusted control to do the HTTP request and file saving for you behind the scenes. SoftArtisans XFile is one such product that can do this.
-Chris
|||
Hi Chris,
Thank you for your answer. I'm afraid I will have to think in another solution.
As Report is generated from Reporting Services I thought I could have another parameter to force the "save" at the time I render the Report.
Best regards
sql