Showing posts with label instead. Show all posts
Showing posts with label instead. Show all posts

Friday, March 30, 2012

Saving Time Format in SQL

Dear all,
I have a table in which I have a field of type datetime.
If I insert a time value through a SP, SQL adds automatically a default
date.(instead of '8:30 AM' it inserts '1/1/1900 8:30 AM')
and if I manually edit/insert a value from the result pane, the data is
'8:30 AM' as I want it.
My question is: How to save only the time in the table via SP?
Thanks in advance.
jouj.> My question is: How to save only the time in the table via SP?
Impossible in the datetime datatype. EM is fooling you and will put in date
1899-12-31 (I think) and
for some curious reason not display that date. Do a SELECT from Query Analyz
er and you will see. I
suggest you read this article to de-mystify the datetime datatypes in SQL Se
rver:
http://www.karaszi.com/SQLServer/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"jouj" <jouj@.discussions.microsoft.com> wrote in message
news:E8F456B7-C962-4B6F-A321-43852876E0F3@.microsoft.com...
> Dear all,
> I have a table in which I have a field of type datetime.
> If I insert a time value through a SP, SQL adds automatically a default
> date.(instead of '8:30 AM' it inserts '1/1/1900 8:30 AM')
> and if I manually edit/insert a value from the result pane, the data is
> '8:30 AM' as I want it.
> My question is: How to save only the time in the table via SP?
> Thanks in advance.
> jouj.
>|||Thank you Mr. Karaszi.
jouj
"Tibor Karaszi" wrote:

> Impossible in the datetime datatype. EM is fooling you and will put in dat
e 1899-12-31 (I think) and
> for some curious reason not display that date. Do a SELECT from Query Anal
yzer and you will see. I
> suggest you read this article to de-mystify the datetime datatypes in SQL
Server:
> http://www.karaszi.com/SQLServer/info_datetime.asp
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "jouj" <jouj@.discussions.microsoft.com> wrote in message
> news:E8F456B7-C962-4B6F-A321-43852876E0F3@.microsoft.com...
>

Saving Time Format in SQL

Dear all,
I have a table in which I have a field of type datetime.
If I insert a time value through a SP, SQL adds automatically a default
date.(instead of '8:30 AM' it inserts '1/1/1900 8:30 AM')
and if I manually edit/insert a value from the result pane, the data is
'8:30 AM' as I want it.
My question is: How to save only the time in the table via SP?
Thanks in advance.
jouj.
> My question is: How to save only the time in the table via SP?
Impossible in the datetime datatype. EM is fooling you and will put in date 1899-12-31 (I think) and
for some curious reason not display that date. Do a SELECT from Query Analyzer and you will see. I
suggest you read this article to de-mystify the datetime datatypes in SQL Server:
http://www.karaszi.com/SQLServer/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"jouj" <jouj@.discussions.microsoft.com> wrote in message
news:E8F456B7-C962-4B6F-A321-43852876E0F3@.microsoft.com...
> Dear all,
> I have a table in which I have a field of type datetime.
> If I insert a time value through a SP, SQL adds automatically a default
> date.(instead of '8:30 AM' it inserts '1/1/1900 8:30 AM')
> and if I manually edit/insert a value from the result pane, the data is
> '8:30 AM' as I want it.
> My question is: How to save only the time in the table via SP?
> Thanks in advance.
> jouj.
>
|||Thank you Mr. Karaszi.
jouj
"Tibor Karaszi" wrote:

> Impossible in the datetime datatype. EM is fooling you and will put in date 1899-12-31 (I think) and
> for some curious reason not display that date. Do a SELECT from Query Analyzer and you will see. I
> suggest you read this article to de-mystify the datetime datatypes in SQL Server:
> http://www.karaszi.com/SQLServer/info_datetime.asp
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "jouj" <jouj@.discussions.microsoft.com> wrote in message
> news:E8F456B7-C962-4B6F-A321-43852876E0F3@.microsoft.com...
>

Saving Report Viewer rending as an HTML file

I'm trying to get an HTML rendering to an html file instead of being displayed in Internet Explorer. My idea is that maybe I could launch an Internet Explorer with an .aspx page that contains a report viewer. I want to be able to capture the output of the Report Viewer control and save off that HTML to a file and immediately close the IE window.
I have read a post or two on other messageboards from people who said that they have done it, and I also heard from a Microsoft source that this is a perfectly acceptable way of capturing an HTML output since MS removed that export capability before they released the control.
What I'm asking to be done could probably be done on any web control that renders HTML, I just don't know how to do it in the general sense (steal the rendering stream from a web control and save the stream off to a file.)
Hopefully what I said makes sense.
If anyone has any suggestions on how to handle that, I would greatly appreciate it.
Thanks,
Ken
Ken, this gets the report output in a stream, I assume you can take it from there. I found this as an example of someone converting to excel(note the commented out line). So I have not really tested this, I just wanted to help.

Response.Clear()

Response.Buffer =True

' Response.ContentType = "application/vnd.ms-excel"

Response.ContentType = "text/html"

Response.Charset = ""

Dim oStringWriterAsNew System.IO.StringWriter

Dim oHtmlTextWriterAsNew System.Web.UI.HtmlTextWriter(oStringWriter)

oHtmlTextWriter.Write("<html><head>")

oHtmlTextWriter.Write("<style>")

oHtmlTextWriter.Write(".dataGridHeader{font-weight: bold;font-size:8pt;color: black;font-family: Verdana;background-color: #ddddee;text-align:left;}")

oHtmlTextWriter.Write(".dataGridItemStyle{font-size: 8pt;color: black;font-family: Verdana;text-align: left;}")

oHtmlTextWriter.Write("</style>")

oHtmlTextWriter.Write("</head><body>")

oHtmlTextWriter.WriteBeginTag("form runat=server ")

oHtmlTextWriter.WriteAttribute("target", "_blank")

oHtmlTextWriter.Write(">")

ReportViewer1.RenderControl(oHtmlTextWriter)

oHtmlTextWriter.Write("</form></body></html>")

Response.Write(oStringWriter.ToString())

Response.End()

sql

Wednesday, March 28, 2012

saving mp3 files in the database

has anyone got any opinions on the pros/cons of storing mp3 files in the database instead of the file system ?

How could this be done ? Would it be a binary data type ?

It would be done exactly the same way images (or any document type for that matter) are stored in the database. Search this forum, there are plenty of examples on just how to do that (one today, and one yesterday that I saw).

Saturday, February 25, 2012

SAN expansion with Basic disks instead of Dynamic?

Hi all,
From what I've read, dynamic disks are not supported as shared drives
when using a Windows 2003 cluster, only basic disks.
What happens when you want to add more capacity to your cluster's shared
disk by adding more physical disks to the SAN? Will it work if the
shared disks are basic? I thought you needed to use dynamic disks to do
this?
thanks a lot,
alec
It is possible but it isn't easy. It also depends on how the manufacturer
presents the LUN to the OS.
How to Extend the Partition of a Cluster Shared Disk
http://support.microsoft.com/default...uct=winsvr2003
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Alec Waters" <alec.waters@.NdatalineO.ScoP.AukM> wrote in message
news:4163fc8b$0$17588$afc38c87@.news.easynet.co.uk. ..
> Hi all,
> From what I've read, dynamic disks are not supported as shared drives
> when using a Windows 2003 cluster, only basic disks.
> What happens when you want to add more capacity to your cluster's shared
> disk by adding more physical disks to the SAN? Will it work if the
> shared disks are basic? I thought you needed to use dynamic disks to do
> this?
> thanks a lot,
> alec
> --
>