Manipulating Varchars As Datetime

Aug 10, 2007

Hi all,

I am a little weak at SQL, so bear with me.

Can anyone give me an SP which uses "Between" to Display all Dates

BETWEEN a fromDate and toDate???

Two conditions

1.Both Dates are stored as varchar.

2. I should be able to get the dates even if years are different, say between 20th December 2006 and 3rd January 2007

3.Is there a way to extract the yearDiff? 

Regards,

Naveen

View 2 Replies


ADVERTISEMENT

Manipulating Datetime

Dec 16, 1998

Hi ppl

How do I subtract, say an integer from a datetime value. I tried to use the Convert function but wont work.
All I want to do in my SP is subtract an integer from getdate() and do a query based on the result
I get from that subtraction.

ex: getdate()-15 ?????????????????????????????????

View 1 Replies View Related

Separating Text Into Separate Varchars

May 10, 2005

with varchars having a max of 8000 bytes and partly because of the coder before me, I'm stuck with using text. the text has a maximum of 30,000 characters, i've tried everything to try to separate the text into 4 different varchars to no avail.. none of the string functions (left, substring, right) works on a text field, and when i try to convert it to a varchar (i.e. convert(varchar(8000), @text)) it obviously only takes the first 8000 characters...

what can i do in this case? any help would be appreciated! thanks in advance!

View 2 Replies View Related

Using User Defined Type Instead Of Varchars

Jul 20, 2005

A common request for enhancement to applications is to "make thisfield bigger". I know I've been caught with increasing a field size,and then spending hours debugging because another stored proc has avariable or temp table that uses the field defined as the originalvarchar size. SQL Server just truncates to fit the data into thesmaller varchar, and so there are no errors raised.An option suggested by a colleague is to no longer use varchars, butuse User Defined Types instead. To make this work effectively,though, they suggest we would need to make it a rule that we do notuse varchars anywhere except to define user defined types.Though there will be one point of changes I can't help thinking thisisn't a very good idea ! Any thoughts ?Thanks.

View 2 Replies View Related

Implicit Conversion Error - Adding Different Varchars Together

Aug 27, 2005

Hi I get the following error:

Implicit conversion of varchar value to varchar cannot be done
because the collation of the value is unresoved due to a collation
conflict


SELECT
    Accounts_Users.NameFirst + ' '
+ Accounts_Users.NameLast + ' (' + Accounts_Users.BusinessUnit + ')' AS
NameFull,  -- Error here
--    Accounts_Users.NameFirst + ' ' + Accounts_Users.NameLast AS NameFull,  -- This line works
    Accounts_Users.EmailAddress, Accounts_Users.BusinessUnit
    FROM Accounts_Users.Accounts_Users


NameFirst and NameLast are VarChar(30) and BusinessUnit VarChar(50), I
did try converting it to 30 also but still got the same error

The sp works on my dev sql server but not on the live one, I am using Management Console v2 (dev) and 1.2 (live server)

Thanks

Steve

View 2 Replies View Related

Visual Interdev Truncates Long Varchars At 255

Sep 28, 1999

We have an application that uses ASP pages to get data from a SQL 7.0 database. One of the stored procedures that is called brings back a comment field that is a varchar(2000). For some reason, when this SP is called from the ASP page, the field is truncated at 255 characters. If the SP is run in the Query Analyzer, all 2000 characters are brought back (after we reset the default length in QA).

Is there any way for the ASP page to bring back more than 255 characters?

View 1 Replies View Related

Manipulating Strings

May 7, 2008

Hi All

I've got a list of IDs seperated by commas and I want to get each indivdual ID and insert them into a table. Has anybody got any ideas how this can be done?

Thanks

View 6 Replies View Related

Manipulating Dates In SQL

Jan 18, 2007

I need to generate a date range, based on the current date (or an input date). I can get the correct dates using VB, but I haven't worked out the TSQL Syntax for them yet. Can anyone tell me the TSQL syntax for manipulating dates in the following way...?

Start Date... This is the first day of the month, one year ago... in VB I worked it out as...

dateadd("yyyy",-1,(cdate(cstr(Year(now))+"-"+cstr(Month(now))+"-01")))

End Date... This is the last day of the previous month... in VB I worked this one out as...

dateadd("d",-1,(cdate(cstr(Year(now))+"-"+cstr(Month(now))+"-01")))

eg. for today 18/01/2007 I would get a Start date of 01/01/2006 and an End date of 31/12/2006

Any help would be appreciated.

View 4 Replies View Related

Manipulating Data In Sqldatasource

Jan 16, 2008

[I am new to asp.net]
Assume I have a databse for "products"; product id is a primary key.
Here is what I am trying to:
1. DetailsView for a product (eg id = 1110) (I got this far)
2. how can I list other products starting with 111x id
3. I also to show them on same page as 1110 as "parent" 111x as children
 Thanks,

View 5 Replies View Related

Manipulating Large Tables

Feb 15, 2008

I'm in the midst of a long file conversion job. Today I found that one of the tables (converted from csv) to be 6.7 million records. My sql script which I use to reconfigure the weird original date format, into something the rest of the planet uses, times out due to the size.

Does anyone please know of a file utility to automagically split sql server 2005 tables for later re-combining once my scripts have successfully completed their task on the smaller tables?

View 7 Replies View Related

Manipulating A SqlDatSource UpdateCommand In Code-behind

Jul 20, 2007

We've got an employee database that I'm modifying to include two photos of each employee, a small thumbnail image and a full-size image.  The HR department maintenance page contains a listbox of employee names, which, when clicked, populates a detailsview control.To get the images to display and be updatable, I've had to structure the following SqlDatasource and DetailsView:
1    <asp:DetailsView ID="dvEmp" runat="server"2      AutoGenerateRows="false"3      DataSourceID="dsEmpView"4      DataKeyNames="empID">5    <Fields>6    <asp:CommandField ShowEditButton="true" ShowCancelButton="true" ShowInsertButton="true" />7    <asp:BoundField HeaderText="Name (Last, First)" DataField="empname" />8    <asp:TemplateField HeaderText="Thumbnail photo">9    <ItemTemplate>10   <asp:Image ID="imgThumbnail" runat="server" ImageUrl='<%# formatThumbURL(DataBinder.Eval(Container.DataItem,"empID")) %>' />11   </ItemTemplate>12   <EditItemTemplate>13   <asp:Image ID="imgThumbHidden" runat="server" ImageUrl='<%# Bind("thumbURL") %>' Visible="false" />14   <asp:FileUpload ID="upldThumbnail" runat="server" />15   </EditItemTemplate>16   </asp:TemplateField>17   <asp:TemplateField HeaderText="Full Photo">18   <ItemTemplate>19   <asp:Image ID="imgPhoto" runat="server" ImageUrl='<%# formatImageURL(DataBinder.Eval(Container.DataItem,"empID")) %>'  />20   </ItemTemplate>21   <EditItemTemplate>22   <asp:Image ID="imgPhotoHidden" runat="server" ImageUrl='<%# Bind("photoURL") %>' Visible="false" />23   <asp:FileUpload ID="upldPhoto" runat="server" />24   </EditItemTemplate>25   </asp:TemplateField>26   </Fields>27   </asp:DetailsView>28   29   <asp:SqlDataSource ID="dsEmpView"30     runat="server"31     ConnectionString="<%$ ConnectionStrings:eSignInConnectionString %>"32     OnInserting="dsEmpView_Inserting"33     OnUpdating="dsEmpView_Updating"34     SelectCommand="SELECT empID, empname, photoURL, thumbURL FROM employees where (empID = @empID)"35     InsertCommand="INSERT INTO employees (empname, photoURL, thumbURL) values(@empname, @photoURL, @thumbURL)"36     UpdateCommand="UPDATE employees SET empname=@empname, photoURL=@photoURL, thumbURL=@thumbURL WHERE (empID = @empID)">37     <SelectParameters>38       <asp:ControlParameter ControlID="lbxEmps" Name="empID" PropertyName="SelectedValue" Type="Int16" />39     </SelectParameters>40   </asp:SqlDataSource>41   42   -----43   44   Protected Sub dsEmpView_Updating(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs)45     Dim bAbort As Boolean = False46     Dim bThumb(), bPhoto() As Byte47     If e.Command.Parameters("@ename").Value.trim = "" Then bAbort = True48     Dim imgT As FileUpload = CType(dvEmp.FindControl("upldThumbnail"), FileUpload)49     If imgT.HasFile Then50       Using reader As BinaryReader = New BinaryReader(imgT.PostedFile.InputStream)51         bThumb = reader.ReadBytes(imgT.PostedFile.ContentLength)52         e.Command.Parameters("@thumbURL").Value = bThumb53       End Using54     End If55     Dim imgP As FileUpload = CType(dvEmp.FindControl("upldPhoto"), FileUpload)56     If imgP.HasFile Then57       Using reader As BinaryReader = New BinaryReader(imgP.PostedFile.InputStream)58         bPhoto = reader.ReadBytes(imgP.PostedFile.ContentLength)59         e.Command.Parameters("@photoURL").Value = bPhoto60       End Using61     End If62     e.Cancel = bAbort63   End SubIf the user updates both images at the same time by populating their respective FileUpload boxes, everything works as advertized.  But if the user only updates one image (or neither image), things break. If they upload, say, just the full-size photo during an update, then it gives the error "System.Data.SqlClient.SqlException: Operand type clash: nvarchar is incompatible with image".I think this error occurs because the update command is trying to set the parameter "thumbURL" without having any actual data to set.  But since I really don't want this image updated with nothing, thereby erasingthe photo already in the database, I'd rather remove this parameter from the update string.So, let's remove the parameter that updates that image by adding the following code just after the "End Using" lines: Else
Dim p As SqlClient.SqlParameter = New SqlClient.SqlParameter("@thumbURL", SqlDbType.Image)
e.Command.Parameters.Remove(p)
(Similar code goes into the code block that handles the photo upload)Running the same update without an image in the thumb fileupload box, I now get this error: "System.ArgumentException: Attempted to remove an SqlParameter that is not contained by this SqlParameterCollection."Huh?  It's not there?  Okay, so lets work it from the other end: let's remove all references to the thumbURL and photoURL from the dsEmpView datasource.  We'll make its UpdateCommand = "UPDATE employees SET empname=@empname WHERE (empID = @empID)", and put code in the dsEmpView_Updating sub that adds the correct parameter to the update command, but only if the fileupload box has something in it.  Therefore: If imgT.HasFile Then
Using reader As BinaryReader = New BinaryReader(imgT.PostedFile.InputStream)
bThumb = reader.ReadBytes(imgT.PostedFile.ContentLength)
e.Command.Parameters.Add(New SqlClient.SqlParameter("@thumbURL", SqlDbType.Image, imgT.PostedFile.ContentLength))
e.Command.Parameters("@thumbURL").Value = bThumb
End Using
End If
(Similar code goes into the code block that handles the photo upload)But reversing the angle of attack only reverses the error. Uploading only the photo and not the thumb image results in: "System.Data.SqlClient.SqlException: The variable name '@photoURL' has already been declared. Variable names must be unique within a query batch or stored procedure."So now it's telling me the parameter IS there, even though I just removed it.ARRRGH!What am I doing wrong, and more importantly, how can I fix it?Thanks in advance. 

View 5 Replies View Related

Manipulating String To Return First Value Before Space

Dec 10, 2001

I have data coming back like below

140 KB 8 KB 1450 KB

I would like to manipulate the string to pull out only the number value. There is always a space between the number and the "KB". Looked at replace but got stuck, any help appreciated.

View 3 Replies View Related

Manipulating Individual Fields Of A View

Nov 13, 2007

In my database I have a table for Users, with an int primary key, and a table for Connections, with a combined primary key consisting of two UserID foreign keys. (the smallest first)

At the point I am stuck I have one UserID, lets call it current_user, and a column returned by a select statement consisting of UserIDs. Some of these IDs will likely be smaller than current_user, and some will likely be larger.

What i need to do is construct a view of two columns, combining each of the UserIDs in the column I have with current_user, with the smallest UserID of each pair residing in the first column, and the largest in the second column.

The point of this is to then SELECT the connections identified by the UserID pairs.

I suspect I could accomplish this if I could set individual fields in the a view, but I seem to have missed (or forgotten) that lecture. Anybody want to clue me in?

View 6 Replies View Related

Manipulating Multiple Count(*) Queries

Dec 15, 2006

Hi,
I'm having problems manipulating the results from multiple count(*) queries.

I have a table 'RECOMMENDATIONS' holding a field called 'SCORE'. This field holds a number from 1 to 10 and has no null or zero figures.

I currently have the following three queries:
1) SELECT COUNT(*) FROM RECOMMENDATIONS WHERE SCORE IN (1,2,3,4,5,6)
2) SELECT COUNT(*) FROM RECOMMENDATIONS WHERE SCORE IN (9,10)
3) SELECT COUNT(*) FROM RECOMMENDATIONS

I now need to combine these three queries so that i can divide and multiply the resulst: (query 2/query 1)*query 3

My initial idea was:
SELECT (COUNT(*)/(SELECT COUNT(*) FROM RECOMMENDATIONS WHERE SCORE IN (1,2,3,4,5,6)))* (SELECT COUNT(*) FROM RECOMMENDATIONS) FROM RECOMMENDATIONS WHERE SCORE IN (9,10)

... but this gives a result of "0". I then stripped out the multiplication section to see if the divide was working:
SELECT COUNT(*)/(SELECT COUNT(*) FROM RECOMMENDATIONS WHERE SCORE IN (1,2,3,4,5,6)) FROM RECOMMENDATIONS WHERE SCORE IN (9,10)

... and again the result was "0"

Please could someone help me!!

Ian

View 2 Replies View Related

Manipulating Table In Store Procedure

Mar 5, 2007

Hi
I am new to SQL programming. This is what I am trying to do in store procedure.
Alter a table - adding two columns.
Then update those columns
Both the above action in same procedure .
When I execute them - it complains that the columns I am adding in the first part of store procedure , does not exists.
So the SP looks like this
create store procedure <name> as
alter table <name> ADD
column_1 nvarchar (256),
column_2 nvarchar (256);

update table
set
column_1 = <condition>
column_2 = <condition>

The SQL complains -
invalid column name column_1
invalid column name column_2

Can some one help please...

View 3 Replies View Related

Manipulating The Result Set Of One Stored Procedure From Another....

Jul 23, 2005

Hi,I have one stored procedure that calls another ( EXEC proc_abcd ). I wouldlike to return a result set (a temporary table I have created in theprocedure proc_abcd) to the calling procedure for further manipulation. Howcan I do this given that TABLE variables cannot be passed into, or returnedfrom, a stored procedure?Thanks,RobinExample: (if such a thing were possible):DECLARE @myTempTable1 TABLE ( ID INT NOT NULL )DECLARE @myTempTable2 TABLE ( ID INT NOT NULL )...../*Insert a test value into the first temporary table*/INSERT INTO @myTempTable1 VALUES ( 1234 )...../*Execute a stored procedure returning another temporary table ofvalues.*/EXEC proc_abcd @myTempTable2 OUTPUT......../*Insert the values from the second temporary table into the first.*/SELECT * INTO @myTempTable1 FROM @myTempTable2

View 1 Replies View Related

Transact SQL :: Manipulating Full Name Field

Sep 22, 2015

I have a column with Full Names (e.g. Jane Doe)...how can I transform it via t-sql for end resutl Doe, Jane?

View 8 Replies View Related

Manipulating GetDate() To Start At Midnight Rather Than Now

Apr 29, 2008

Hi Folks,

I am trying to find the best way to use the getDate() function in SQL Server CE to return a date and time which starts at midnight rather than the value of now which getDate() returns.

When running getDate I get the value of 29/04/2008 10:48:33 returned, but I want to return 29/04/2008 00:00:00 instead.
The only way I can see to do this is like so:




Code Snippet

--SQL to get shifts for next 7 days.
select * from SHIFTS

where STARTDATE between
--Today at midnight 2008-04-29 00:00:00.000

(convert(datetime,

convert(nvarchar,(datepart(yyyy,getdate()))) + '/'

+

convert(nvarchar,(datepart(MM,getdate()))) + '/'

+

convert(nvarchar,(datepart(dd,getdate())))

))

and
--7 days from now at night 2008-05-05 00:00:00.000
(

convert( datetime,

convert(nvarchar,(datepart(yyyy,getdate()+6))) + '/'

+

convert(nvarchar,(datepart(MM,getdate()+6))) + '/'

+

convert(nvarchar,(datepart(dd,getdate()+6)))

))





Is there a better way to do this rather than this long winded method?

Thanks,

Morris

View 1 Replies View Related

Manipulating A Text Box In Custom Code.

Nov 21, 2006

Hi there,

A simple question I hope. I have got a textbox on a report and I'm trying to populate it by calling a custom assembly. I know I can reference it directly in the textbox (this works) but I am trying to do this from the code block. The following code didn't work:

Protected Overrides Sub OnInit()
ReportItems!textbox2.Value = POCCustomAssembly.CustAssembly.Hello()
End Sub

The TextBox is called textbox2 and the custom assembly simply returns a string.

I get an error message "The is an error on line 1 of custom code: [BC30469] Reference to a non-shared member requires an object reference".

What am I doing wrong?

View 6 Replies View Related

Manipulating Large Ntext Data With ADO Recordset

Mar 20, 2000

I am having a problem writing a large amount of ntext data to a field within an ADO recordset. I am using the append chunk method but it does not seem to work. The SQL 7 field will hold the data its only about 60K.

View 1 Replies View Related

Manipulating Text,nText Data Types Filed In Tsql

Jul 12, 2006

I have to run a dynamic sql that i save in the database as a TEXT data type(due to a large size of the sql.) from a .NET app.  Now i have to run this sql from the stored proc that returns the results back to .net app. I am running this dynamic sql with sp_executesql like this..
EXEC sp_executesql @Statement,N'@param1 varchar(3),@param2 varchar(1)',@param1,@param2,GO
As i can't declare text,ntext etc variables in T-Sql(stored proc), so i am using this method in pulling the text type field "Statement".
DECLARE @Statement varbinary(16)SELECT @Statement = TEXTPTR(Statement)FROM table1 READTEXT table1.statement @Statement 0 16566
So far so good, the issue is how to convert @Statment varbinary to nText to get it passed in sp_executesql.
Note:- i can't use Exec to run the dynamic sql becuase i need to pass the params from the .net app and Exec proc doesn't take param from the stored proc from where it is called.
I would appreciate if any body respond to this.
 
 
 

View 2 Replies View Related

Millisecond Values Missing When Inserting Datetime Into Datetime Column Of Sql Server

Jul 9, 2007

Hi,
I'm inserting a datetime values into sql server 2000 from c#

SQL server table details
Table nameate_test
columnname datatype
No int
date_t DateTime

C# coding
SqlConnection connectionToDatabase = new SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=testdb;Integrated Security=SSPI");
connectionToDatabase.Open();
DataTable dt1 = new DataTable();
dt1.Columns.Add("no",typeof(System.Int16));
dt1.Columns.Add("date_t", typeof(System.DateTime));
DataRow dr = dt1.NewRow();
dr["no"] = 1;
dr["date_t"] = DateTime.Now;
dt1.Rows.Add(dr);
for(int i=0;i<dt1.Rows.Count;i++)
{
string str=dt1.Rows["no"].ToString();
DateTime dt=(DateTime)dt1.Rows["date_t"];
string insertQuery = "insert into date_test values(" + str + ",'" + dt + "')";
SqlCommand cmd = new SqlCommand(insertQuery, connectionToDatabase);
cmd.ExecuteNonQuery();
MessageBox.Show("saved");
}
When I run the above code, data is inserted into the table
The value in the date_t column is 2007-07-09 22:10:11 000.The milliseconds value is always 000 only.I need the millisecond values also in date_t column.
Is there any conversion needed for millisecond values?

thanks,
Mani

View 3 Replies View Related

Inserting Datetime Through Sqldatasource - String Was Not Recognized As A Valid DateTime

Dec 6, 2006

I'm getting error:
String was not recognized as a valid DateTime.
my insert parameter: 
<asp:Parameter Name="LastModified" Type="DateTime" DefaultValue= "<%=DateTime.Now.ToString() %>"
my insert command:
InsertCommand="INSERT INTO [Product] ([Enabled], [ProductCode], [ProductName], [ProductAlias], [CarrierId], [DfltPlanId], [DoubleRating], [DoubleRateProductId], [ConnCharges], [StartDate], [EndDate], [Contracted], [BaseProductId], [LastModified], [LastUser]) VALUES (@Enabled, @ProductCode, @ProductName, @ProductAlias, @CarrierId, @DfltPlanId, @DoubleRating, @DoubleRateProductId, @ConnCharges, @StartDate, @EndDate, @Contracted, @BaseProductId, @LastModified, @LastUser)"
LastModified is a datetime field.
 Running sql2005

View 1 Replies View Related

DateTime Unable To Save In Datetime Field Of SQL Database

Mar 14, 2007

 Hi all, having a little problem with saving dates to sql databaseI've got the CreatedOn field in the table set to datetime type, but every time i try and run it i get an error kicked up  Error "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated."I've tried researching it but not been able to find something similar.  Heres the code: DateTime createOn = DateTime.Now;string sSQLStatement = "INSERT INTO Index (Name, Description, Creator,CreatedOn) values ('" + name + "','" + description + "','" + userName + "','" + createOn + "')"; Any help would be much appreciated 

View 4 Replies View Related

SQL Query: Finding Records Between Datetime Inside Datetime

Mar 17, 2007

Hey :)I'm facing a lot of troubles trying to create a new pause/break-system. Right now i'm building up the query that counts how many records that is inside 2 fields. Let me first show you my table:
ID (int)     |    stamp_start (Type: DateTime)        |      stamp_end (Type: DateTime)           |      Username (varchar)0             |      17-03-07 12:00:00                      |            17-03-07 12:30:00                     |     Hovgaard
The client will enter a start time and a end time and this query should then count how many records that are inside this periode of time.
 Example: The client enter starttime: 12:05 and endtime: 12:35.The query shall then return 1 record found. The same thing if the user enters 12:20 and 12:50.My current query looks like this:SELECT COUNT(ID) AS Expr1 FROM table WHERE (start_stamp <= @pausetime_start) AND (end_stamp >= @pausetime_end)But this will only count if I enter the exact same times as the one inside the table.Any ideas how I can figure this out?Thanks for your time so far :)/Jonas Hovgaard - Denmark

View 2 Replies View Related

Datetime Data Type Resulted In An Out-of-range Datetime Value. Please Help

May 13, 2006

Hi,
I have a column of type datetime in sqlserver 2000. Whenever I try to insert the date
 '31/08/2006 23:28:59'
 I get the error "...datetime data type resulted in an out-of-range datetime value"
I've looked everywhere and I can't solve the problem. Please note, I first got this error from an asp.net page and in order to ensure that it wasn't some problem with culture settings I decided to run the query straight in Sql Query Anaylser. The results were the same. What else could it be?
cheers,
Ernest

View 2 Replies View Related

Convert Datetime String To Datetime Date Type

Mar 11, 2014

I am inserting date and time data into a SQL Server 2012 Express table from an application. The application is providing the date and time as a string data type. Is there a TSQL way to convert the date and time string to an SQL datetime date type? I want to do the conversion, because SQL displays an error due to the

My date and time string from the application looks like : 3/11/2014 12:57:57 PM

View 1 Replies View Related

Retrieving A Datetime With A Time Of Midnight (from A Typical Datetime)

Sep 7, 2007

Nothing difficult, I just need a way to generate a new datetime column based on the column [PostedDate], datetime. So basically I want to truncate the time. Thanks a lot.

View 5 Replies View Related

Datetime W/ Format = D Still Showing Time Component Of Datetime

Jan 17, 2008

e.g.

1st March 2005 12:00:00

is showing as

01/03/2005 00:00:00

instead of

01/03/2005


Why does this happen?

View 4 Replies View Related

Comparing A Real Datetime To A 'constructed' Datetime

Jun 15, 2004

I have the following SQL:

select convert(datetime,'04-20-' + right(term,4)) as dt,
'Deposit' as type, a.* from
dbo.status_view a

where right(term,4) always returns a string which constitutes a 4 digit year eg '1999','2004',etc.

The SQL above returns

2004-04-20 00:00:00.000 Deposit ...

Which makes me think that it is able to successfully construct the datetime object inline. But then when I try and do:

select * from
(
select convert(datetime,'04-20-' + right(term,4)) as dt,
'Deposit' as type, a.* from
dbo.status_view a
) where dt >= a.submit_date

I get the following error:

Syntax error converting datetime from character string.

Given that it executes the innermost SQL just fine and seems to convert the string to a datetime object, I don't see why subsequently trying to USE that datetime object for something (in this case comparison with submit_date which is a datetime in the table a) should screw it up. Help!!! Thanks...

View 6 Replies View Related

How To Convert Datetime From Text/char To Datetime

Jul 20, 2005

Hi,I have a text file that contains a date column. The text file will beimported to database in SQL 2000 server. After to be imported, I wantto convert the date column to date type.For ex. the text file look likeName dateSmith 20003112Jennifer 19991506It would be converted date column to ydm database in SQL 2000 server.In the table it should look like thisName DateSmith 2000.31.12Jennifer 1999.15.06Thanks in advance- Loi -

View 1 Replies View Related

Convert DateTime To A DateTime With Milliseconds Format

Nov 5, 2007

Hi,

I am trying to access a date column up to millisecond precession. So I cast date to as follows:



Code BlockCONVERT(varchar(23),CREATE_DATE,121)


I get millisecond part as a result of query but it€™s €œ000€?.

When I try to test the format by using getDate instead of DateTime column I get right milliseconds.





CONVERT(varchar(23),GetDate(),121) --Gives right milliseconds in return

View 4 Replies View Related

How To Convert Datetime From Varchar To Datetime

Sep 11, 2007

hi,
How do i convert a varchar field into the datetime data type? the reason i need this lies in the requirement that in the earlier data base the column that is hlding the date value is having the data type as varchar. and in the new design the column data type is datetime. i am using sql scripts for the data migration from the older design to the newer and got stuck with this datetime convertion issue. do let me know the best possible solution.

following are the sample data that is theer in the older table for the date.


12/12/2003
1/13/2007
01132004
1-1-2004
1.2.2001



there is no uniformity of the data that is stored currently.



thnkx in adv.
rahul jha

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved