Date/Time Before 1753??!?!???!?
Apr 19, 2002
According to books online, a datetime data type is:
Date and time data from January 1, 1753 through December 31, 9999, to an accuracy of one three-hundredth of a second.
So how do I have a date before 1753??!? possible?!?
TIA,
-Henry
View 2 Replies
ADVERTISEMENT
Mar 26, 2007
Hi,
I have a flat file that is read in by SSIS and then populates our db.
In this flat file there are blank spaces that represent null entries, which are date time values that we need to remain null but instead shows up in the table as the lowest date time value (1753)
Does SSIS automatically convert this since this is not done in our code?
Regards
Mike
View 13 Replies
View Related
Jun 30, 2007
This is driving me nuts..
I'm trying to extract some data from a table in oracle. The oracle table stores date and time seperately in 2 different columns. I need to merge these two columns and import to sql server database.
I'm struggling with this for a quite a while and I'm not able to get it working.
I tried the oracle query something like this,
SELECT
(TO_CHAR(ASOFDATE,'YYYYMMDD')||' '||TO_CHAR(ASOFTIME,'HH24:MM : SS')||':000') AS ASOFDATE
FROM TBLA
this gives me an output of 20070511 23:06:30:000
the space in MM : SS is intentional here, since without that space it appread as smiley
I'm trying to map this to datetime field in sql server 2005. It keeps failing with this error
The value could not be converted because of a potential loss of data
I'm struck with error for hours now. Any pointers would be helpful.
Thanks
View 3 Replies
View Related
Aug 5, 2015
I'm looking for a way of taking a query which returns a set of date time fields (probable maximum of 20 rows) and looping through each value to see if it exists in a separate table.
E.g.
Query 1
Select ID, Person, ProposedEvent, DayField, TimeField
from MyOptions
where person = 'me'
Table
Select Person, ExistingEvent, DayField, TimeField
from MyTimetable
where person ='me'
Loop through Query 1 and if it finds ANY matching Dayfield AND Timefield in Query/Table 2, return the ProposedEvent (just as a message, the loop could stop there), if no match a message saying all is fine can proceed to process form blah blah.
I'm essentially wanting somebody to select a bunch of events in a form, query 1 then finds all the days and times those events happen and check that none of them exist in the MyTimetable table.
View 5 Replies
View Related
Oct 22, 2015
I am trying to load previous days data at 3 am via a SSIS job.
The Date variable is initiated as DATEADD("dd",-1, GETDATE()) in the for loop.
Now, as this job runs at 3 am, and I set the variable as GETDATE() - 1, it excluded the data from 12 am to 3 am in the resultset as Date is set as YYYY-MM-DD 03:00:00:000 I need this to be set as YYYY-MM-DD 00:00:00:000
How can i do this?
View 2 Replies
View Related
Jun 13, 2002
In SQL Server 2000:
How do I convert a Julian date to a Gregorian date?
How do I convert a Gregorian date to Julian?
Examples please.
Many thanks in advance.
Gary Andrews
View 2 Replies
View Related
Mar 18, 2014
I have the following
Column Name : [Converted Date]
Data Type : varchar(50)
When I try and do month around the [Converted Date] I get the following error message
“Msg 241, Level 16, State 1, Line 2
Conversion failed when converting date and/or time from character string.”
My Query is
SELECT
month([Created Date])
FROM [FDMS_PartnerReporting].[Staging].[Salesforce_MarketingReporting]
View 7 Replies
View Related
Nov 16, 2015
SELECT * ,[Due]
FROM [Events]
Where Due >= getdate() +90
This returns the error: Conversion failed when converting date and/or time from character string
Why would this be? How to cast or convert this so that it will work?
View 24 Replies
View Related
Nov 13, 2007
Hi there.
I'm trying to extract data from my SQL server & everything in the script I've got is working (extracting correct data) except for one field - which is for the most part it's off by +2 days (on a few occasions - I see it off by just +1 day or even +3, but it's usually the +2 days).
I'm told that it's due to the conversion formula - but - since SQL is not my native language, I'm at a bit of a loss.
The DB table has the date field stored as a type: CHAR (as opposed to 'DATE')
Can anyone out there help?
Please advise. Thanks.
Best.
K7
View 1 Replies
View Related
Sep 5, 2007
Dear Expert!
A server with SQL 2005 sp2, Reporting Services and Sharepoint services (ver 3.0) (in integrated mode) gives an odd error. When viewing a Reporting Services report with a Date Time Picker, the date chosen is wrong. The preferred setting is Danish with the date format dd-mm-yyyy. The date picker shows the months in Danish but when selecting a date, and clicking on the Apply-button, the date reformats to US (mm-dd-yyyy).
Example:
When choosing 5th of September 2007 and clicking apply, it shows in the picker, 9th of May 2007.
When choosing 26th of September 2007 and clicking apply, it shows, again in US format, the RIGHT date but adds a timestamp 12:00 AM? in the end, making further enquiries to fail.
The report itself receives the right date and shows correctly. The only case it fails is, when the time stamp appears.
The server is a 32-bit one with 4 GB RAM. A testserver with identical collation on the Reportserver database cannot recreate the error. The site containing the reports has been set to Danish in the regional settings. To Reinstall is not an option.
The test report has no database connection whatsoever.
When setting the site to US, the timestamp wont appear at all.
The server has been restarted and the installation procedure was of the simple kind. No special tweaks at all.
Any advice would be greatly appreciated.
Kind Regards
Johan Rastenberger
View 1 Replies
View Related
Jan 15, 2002
Hello,
we need to track date/time of last update for each record in a table.
As we understand it, we can't use field type Timestamp as this type does
not use dates/times.
Is there any SQL function available which we can bind to a column or
do we really have to use triggers?
Greetings from Mannheim, Germany
Ricardo
View 2 Replies
View Related
Jan 15, 2002
Hello,
we need to track date/time of last update for each record in a table.
As we understand it, we can't use field type Timestamp as this type does
not use dates/times.
Is there any SQL function available which we can bind to a column or
do we really have to use triggers?
Greetings from Mannheim, Germany
Ricardo
View 1 Replies
View Related
Nov 11, 2013
I want to update the time in a datetime field with the current time.
Fields current value is:
2013-11-11 00:00:00.000
I want to insert this into another table and when I do I want to grab the current time and update that field.
field name: picked_dt
Table: oeordlin
or is there a way through sql to update the time when the picked_dt is updated?
View 2 Replies
View Related
Jun 12, 2007
Hi
i have the following situation. in my database i have a datetime field (dd/mm/yy hh:mms) and i also have a field timezone.
the timezone field has values in minutes that i should add to my datetime field so i have the actual time.
afterwards i split the datetime into date and time.
the last part i can accomplish (CONVERT (varchar, datetime, 103) as DATEVALUE and CONVERT (varchar, DATETIME, 108) as TIMEVALUE).
could anybody tell me how i can add the timezone value (in minutes) to my datetime value ?
i do all the calculations in my datasource (sql).
Thanks
V.
View 3 Replies
View Related
Aug 19, 2007
i am write an archive program, there are some date before 1/1/1753, but there are a constraint of system.data. How can i fix this. Could i change the minimum data to 1/1/1200.
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
View 2 Replies
View Related
Mar 16, 2014
I want to display only the date part of a date field which contains both date & time information.
For example I have the value '2013-11-14 00:00:00.000' in my result set, and ideally I would like to show only '2013-11-14'.
I have looked up the datepart() command, however I can't work out how to return all parts of the date, rather than just the year, month, or day.
View 3 Replies
View Related
Jul 4, 2014
I have passed createdDate from UI to Stored procedure.createdDate field declared with DateTime.it is having value 2014-07-01.I need to fetch records from the database based upon the created field.but Create_TM in database having value Date with timestamp.so how would i change the createdfield in stored procedure.
ALTER PROCEDURE [dbo].[ByDateRange]
@Feed VARCHAR(50),
@CreatedDate DATETIME
select * from Date_table where Create_TM = @CreatedDate
View 1 Replies
View Related
Dec 29, 2005
I have a table named "shift" and I need to setup my query to return only data where the field "startime" = today. The problem I am running into is the starttime field it laid out like "2005-12-29 14:00:00" with different time values. I need to ruturn everything that has todays date regardless of the time value. I tried using GetDate() but that is returning data for other days as well or just data before or after the current time. Does anyone have any suggestions? This is driving me crazy! Thanks, Garrett
View 7 Replies
View Related
Oct 4, 2007
Hello,
We have a bunch of Audit tables that contain almost exact copies of the operations tables. The audit tables also include:
AuditID - the audit action (insert, modify - old, modify - new, deleted)
AuditDate - date and time of action
AuditUser - User who did it...
At the end of the day I need to know for any given record what it looked like at the beginning of the day and what it looks like at the end of the day. There could have been numerous changes to the record throughout the day, those records I am not interested in. Only the first record and the last record of a give day.
I am going to be doing a lot of MIN(AuditDate) and MAX(AuditDATE) and .. WHERE AuditDate BETWEEN '10/1/2007 00:00:00' AND '10/1/2007 11:59:59' ...
Question: Whats better for performance:
1. Separating out the date and time and doing a clusterd index on the date.
2. Keeping date and time in the same column and just use a normal index.
3. Better ideas?
Thanks,
Bradley
View 1 Replies
View Related
Jul 23, 2005
Hello,I have an Access DB with a column [date] holding dates from present day backto around year 1702, and I am trying to run DTS Import with this MDB, whichfails due to a conversion error.MSDN says the datetime data type only allows 1753-01-01 to 1900-01-01, thusI am under the impression having the [date] field as varchar is the only wayto store the dates.My questions are:a) Can dates prior to 1753-01-01 be stored in a date column?b) If dates are in a column of type varchar (or similar) is it possible tosort them chronologically with T-SQL ?c) 1753-01-01 seems particularly arbitrary, any reason for this?Many thanks for any help, it's driving me mad!John
View 6 Replies
View Related
Feb 21, 2007
I cannot for the life of me figure out why im still getting this
error. I have tried everything i can think of from using dbnull.value
to setDOBnull() to datetime.minvalue. Can anyone help me? Here's the code on my BLL:
Public Function AddEmployee(ByVal SSN As String, ByVal FirstName As
String, ByVal LastName As String, ByVal PreferredName As String, ByVal
MaidenName As String, ByVal MaritalStatus As Nullable(Of Char), ByVal
DOB As Nullable(Of Date), ByVal Gender As Nullable(Of Char), ByVal
Ethnicity As String, ByVal StartDate As Nullable(Of Date), ByVal
TerminationDate As Nullable(Of Date)) As Boolean ' Create a new employeeRow instance Dim employees As New HRMS.EmployeesDataTable() Dim employee As HRMS.EmployeesRow = employees.NewEmployeesRow() Dim sqldatenull As SqlDateTime sqldatenull = SqlDateTime.MinValue.Value employee.SSN = SSN employee.FirstName = FirstName employee.LastName = LastName If PreferredName Is Nothing Then employee.SetPreferredNameNull() Else employee.PreferredName = PreferredName If MaidenName Is Nothing Then employee.SetMaidenNameNull() Else employee.MaidenName = MaidenName If Not MaritalStatus.HasValue Then employee.SetMaritalStatusNull() Else employee.MaritalStatus = MaritalStatus.Value If Not DOB.HasValue Then employee.SetDOBNull() Else employee.DOB = DOB.Value If Not Gender.HasValue Then employee.SetGenderNull() Else employee.Gender = Gender.Value If Ethnicity Is Nothing Then employee.SetEthnicityNull() Else employee.Ethnicity = Ethnicity
If StartDate = DateTime.MinValue Then employee.StartDate =
SqlDateTime.MinValue.Value Else employee.StartDate = StartDate.Value 'If StartDate = DateTime.MinValue Then employee.SetDOBNull() Else employee.StartDate = StartDate.Value 'If Not StartDate.HasValue Then employee.StartDate = sqldatenull Else employee.StartDate = StartDate.Value
If TerminationDate = DateTime.MinValue Then employee.TerminationDate =
SqlDateTime.MinValue.Value Else employee.TerminationDate =
TerminationDate.Value P
View 8 Replies
View Related
Jul 16, 2007
Hi there...
i have a search page with consitst of DatePicker and DataView
this is how i'm binding my dataview
<asp:ObjectDataSource runat="server" EnableCaching="false" ID="ods" TypeName="daab.Employee" SelectMethod="GetEmployee"> <SelectParameters> <asp:ControlParameter ControlID="DatePicker1" ConvertEmptyStringToNull="true" PropertyName="SelectedDate" Name="SearchDate" Direction="Input" Type="DateTime" /> </SelectParameters> </asp:ObjectDataSource>
..........................................................................................
the searchDate is optional user may select date from datepicker or leave it blank if (!string.IsNullOrEmpty(DatePicker1.SelectedDate))
{ //
}
else
{
this.ods.SelectParameters["SearchDate"].DefaultValue = DBNull.Value.ToString();
}
when i execute the above code i get this error:, what i'm missing?
error Message = "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."
View 10 Replies
View Related
Apr 10, 2008
hey,
i will make calender(by use Asp.net 2003 - C# - framework 2.0 ) that stored and retreive data from Database(SQL Server 2000), that success , but if add this function (Calendar1_DayRender)
Server Error in '/bwarq' Application.
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.Source Error:
Line 1999:DA.SelectCommand.Parameters.Add("@eventdate",eventdate);
Line 2000:DataTable DT=new DataTable();
Line 2001:DA.Fill(DT);
Line 2002:DA.SelectCommand.Connection.Close();return DT;
Line 2003:}
Source File: c:inetpubwwwroot4paldataaccess.cs Line: 2001
and i want to see my files here:
1- DataAccess(put here Stored proceure)public static DataTable GetCalendar(DateTime eventdate)
{SqlDataAdapter DA=new SqlDataAdapter("GetCalendar",createConn());
DA.SelectCommand.CommandType=CommandType.StoredProcedure;
DA.SelectCommand.Parameters.Add("@eventdate",eventdate);DataTable DT=new DataTable();
DA.Fill(DT);DA.SelectCommand.Connection.Close();return DT;
}
2- User Control Page
private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
DataTable DT=DataAccess.GetCalendar(Calendar1.SelectedDate);if(DT.Rows.Count == 0)
{DGEvent.Visible = false;
}
else
{DGEvent.Visible = true;
DGEvent.DataSource=DT;
DGEvent.DataBind ();
}
}private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
DataTable DT2=DataAccess.GetCalendar(Calendar1.SelectedDate);
// If the month is CurrentMonthif (! e.Day.IsOtherMonth )
{for(int i=0 ; i< DT2.Rows.Count;i++)
{if ((DT2.Rows[i]["eventdate"].ToString() != DBNull.Value.ToString()))
{
DateTime dtEvent= (DateTime)DT2.Rows[i]["eventdate"];if (dtEvent.Equals(e.Day.Date))
{
e.Cell.BackColor = Color.PaleVioletRed;
}
}
}
}
//If the month is not CurrentMonth then hide the Dates
else
{
e.Cell.Text = "";
}
}
so, i want the exaclty solution for this problem,plz
View 1 Replies
View Related
Apr 17, 2008
Yes, I've parsed many a topic on many a site regarding this issue.sigh.I am using a calendar control within a TemplateField on a DetailsView.I know that my SQL DB will accept NULL for my DATETIME field, because if I don't bind the control to the insert, the insert succeedes, yeilding a null for DATETIME in the new record.My problem is that I want the user to be able to choose to not select a date. I find that I have to bind selected value to the insert parameter, so that if they do select a date, it get inserted.( duhh!! ) When I do though, and the user does not select a date, I get the above error.My best guess? it is sending a datetime value of 00:00:0000 00:00:00 (or something like that anyhow)?So... does anyone have any ideeas on a simple way to evaluate the value when the form is submitted? and how to set it to NULL if it is, for example "in the past" or "00:00:0000....." ?
,Gary"We truly fail, only when we quit."
View 11 Replies
View Related
Dec 1, 2005
Hi. I am getting the error described in the title - SqlDateTime overflow. I have read what is available online but am still not able to get rid of it. Help much appreciated... thanks.
The Full Error Is:
Code:
System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value) at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value) at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value) at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb) at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ASP.audiobook_viewdetails_aspx.DetailsView1_ItemInserting(Object Src, DetailsViewInsertEventArgs Args) in C:InetpubwwwrootdushkinmediasupportwebPresentationTieraudiobook_servicesaudiobook_viewdetails .aspx:line 151
And, below is the method that is raising the errors. The
culprit is "created_date" as "DateTime".
Code:
Sub DetailsView1_ItemInserting(ByVal Src As Object, ByVal Args As DetailsViewInsertEventArgs)
'validate the controls
If Args.Values("ISBN") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing ISBN number"
End If
If Args.Values("author_first") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing first name"
End If
If Args.Values("author_last") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing last name"
End If
If Args.Values("publisher") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing Publisher"
End If
If Args.Values("text_description") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing item description"
End If
If Not IsNumeric(Args.Values("regular_price")) Then
Args.Cancel = True
MSG.Text = "-- regular price is not numeric"
Else
If Args.Values("regular_price") < 0 Then
Args.Cancel = True
MSG.Text = "-- regular price is out of range"
End If
End If
If Not IsNumeric(Args.Values("discount_price")) Then
Args.Cancel = True
MSG.Text = "-- Discount price is not numeric"
Else
If Args.Values("discount_price") < 0 Then
Args.Cancel = True
MSG.Text = "-- Discount price is out of range"
End If
End If
'if all the controls are valid, decalre the types
Dim audiobookID As Integer
Dim title As String
Dim author_first As String
Dim author_last As String
Dim publisher As String
Dim ISBN As String
Dim regular_price As String
Dim discount_price As String
Dim text_description As String
Dim created_date As DateTime
' ||||| Set up a Connection Object to the SQL DB
Dim MyConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection("server=ARIA;database=dushkinmedia;Integrated Security=SSPI")
' ||||| Pass in the StoreProcedure or Command String, as well as the Connection object
Dim MyCmd As New System.Data.SqlClient.SqlCommand("sp_RegisterNewAudioBook", MyConn)
' ||||| Set the Command Type (Stored Procedure, Text, etc)
MyCmd.CommandType = System.Data.CommandType.StoredProcedure
' ||||| Create Parameter Objects for values passed in
Dim objParam1, objParam2, objParam3, objParam4, objParam5, objParam6, _
objParam7, objParam8, objParam9, objParam10, objParam11, objParam12, _
objParam13, objParam14, objParam15 As System.Data.SqlClient.SqlParameter
' ||||| Add your parameters to the parameters Collection
objParam1 = MyCmd.Parameters.Add("@audiobookID", Data.SqlDbType.Int)
objParam2 = MyCmd.Parameters.Add("@title", Data.SqlDbType.VarChar)
objParam3 = MyCmd.Parameters.Add("@author_first", Data.SqlDbType.VarChar)
objParam4 = MyCmd.Parameters.Add("@author_last", Data.SqlDbType.VarChar)
objParam5 = MyCmd.Parameters.Add("@publisher", Data.SqlDbType.VarChar)
objParam6 = MyCmd.Parameters.Add("@ISBN", Data.SqlDbType.VarChar)
objParam7 = MyCmd.Parameters.Add("@regular_price", Data.SqlDbType.VarChar)
objParam8 = MyCmd.Parameters.Add("@discount_price", Data.SqlDbType.VarChar)
objParam9 = MyCmd.Parameters.Add("@text_description", Data.SqlDbType.Text)
objParam10 = MyCmd.Parameters.Add("@created_date", Data.SqlDbType.DateTime)
'objParam10 = MyCmd.Parameters.AddWithValue("@img_name", imgName)
objParam11 = MyCmd.Parameters.AddWithValue("@img_data", System.Data.SqlDbType.Image)
'objParam12 = MyCmd.Parameters.AddWithValue("@img_contenttype", imgcontenttype)
'objParam13 = MyCmd.Parameters.AddWithValue("@aud_name", audName)
objParam14 = MyCmd.Parameters.AddWithValue("@aud_data", System.Data.SqlDbType.VarBinary)
'objParam15 = MyCmd.Parameters.AddWithValue("@aud_contenttype", audcontenttype)
' ||||| Set the Parameter values to the passed in values
objParam1.Value = audiobookID
objParam2.Value = title
objParam3.Value = author_first
objParam4.Value = author_last
objParam5.Value = publisher
objParam6.Value = ISBN
objParam7.Value = regular_price
objParam8.Value = discount_price
objParam9.Value = text_description
objParam10.Value = created_date
'objParam11.Value = imgBinaryData
'objParam14.Value = audBinaryData
Try
' ||||| Check if Connection to DB is already open, if not, then open a connection
' ||||| DB not already Open...so open it
MyConn.Open()
MyCmd.ExecuteNonQuery()
' ||||| Close the Connection Closes with it
MyConn.Close()
Catch e As Exception
Beep()
MSG.Text = e.ToString
End Try
'Response.Redirect("~/audiobook_services/audiobook_view.aspx")
End Sub
Any help at all would be MUCH appreciated... Thanks in advance.
View 2 Replies
View Related
Jun 27, 2006
Hi,
Is there a way to catch the exeption (SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM) with in SQL Server, so it does not need to be caught in the code calling the procedure. E.g. I do not want to send null to the stored procedure.
e.g. The stored procedure should be able to catch dates that are outside the range 1/1/1975 and 12/31/9999 and change them to the limits.
E.g.
IF @StartDate < CONVERT(DateTime, '01/01/1753 12:00:00')
BEGIN
SET @StartDate = CONVERT(DateTime, '01/01/1753 12:00:00')
END
IF @EndDate > CONVERT(DateTime, '01/01/1753 11:59:59')
BEGIN
SET @EndDate = CONVERT(DateTime, '12/31/9999 11:59:59')
END
This still throws an exception because the StartDate or EndDate when tested fail the condition.
View 7 Replies
View Related
May 2, 2008
Hi,I need a way of changing the following SQL statement so that the dates are without the hh:mm:ss tt:"Select DISTINCT([StartDate]) From [Events]"How can this be done?Thanks,Curt.
View 4 Replies
View Related
Jan 8, 2013
I have a table in which a date value is stored as varchar.some of these values are stored ina dd/mm/yyyy format and other values are stored in a yyyy-mm-dd format..Now I wish to retrieve some data by querying between two dates. However I need to convert the varchar date value to datetime in order to do this but since the date value is in two different formats, the following doesn't work.
select date_value
from my_table
where CONVERT(DATETIME, date_value, 103) between @date1 and @date2
How can you convert the date value to datetime when its stored in mutiple formats. I can't change the table itself as I dont have admin privelages.
View 14 Replies
View Related
Jan 24, 2008
Hello,
I am using the calender parameter and I need to convert my data date format to the one that matched that is returned on selecting a date from this calender. Can you show me what this format is.
how can I convert my existing date format to this format. The existing date format is 2007-07-26 21:27:13.000
thank you
Kiran
View 5 Replies
View Related
May 16, 2008
How can I obtain just the time portion from a date/time column?
My data contains "2008-05-19 09:30:00.000"
Actually, all I want/need is the hh:mm part of it.
Thanks,
Walt
View 2 Replies
View Related
Jul 8, 2015
I have connected to SQL SERVICES ANALYSIS SERVICE database through excel and when I observed that value of the date attribute is displayed as ######## in the excel for 1/1/1753.
I am able to see the value 1/1/1753 in the Cube browser but not able to see the vale in the excel.
how to replace this value with blank in the excel.
View 3 Replies
View Related
May 5, 2004
SELECT ltrim(str(datepart(yyyy,getdate()))) +'-'+
replicate('0',2-len(ltrim(str(datepart(mm,getdate())))))+ltrim(str (datepart(mm,getdate())))+'-' +replicate('0',2-len(ltrim(str(datepart(dd,getdate())))))
+ltrim(str(datepart(dd,getdate())))
This is how i am getting datepart of datetime.Is there any other way to get the date and also time seperately..
Thanks.
View 14 Replies
View Related
Feb 28, 2008
i have a query
select mydate,lastname from users
group by mydate,lastname
now the only thing is mydate is a datetime fields but i want the results to group by just the date for each lastname entered.
How do i do this?
View 3 Replies
View Related