formatting the date


Originally posted by : narmada
will u plse tell me how to get the time in sql server 7.0
Posted On: Tuesday 20th of November 2012 12:09:26 AM Total Views:  125
View Complete with Replies

RELATED TOPICS OF MYSQL PROGRAMMING LANGUAGE




query formatting issues

Experts Below is the query i am trying to run but i keep getting a #1064 error, not sure what is wrong with the format. Can someone pls help declare @y int declare @m int SET @y =2000 SET @m =01 WHILE @y
VIEWS ON THIS POST

109

Posted on:

Saturday 6th October 2012
View Replies!

Keeping formatting

Hi I am trying to store data in a mysql database. I would like to be able to paste preformatted text in to the form, save it to the DB and call it back to another page and still maintain the formatting. I am currently using "text" but when I call the data back it comes in one big chunk. I have searched and not found an answer.
VIEWS ON THIS POST

163

Posted on:

Friday 12th October 2012
View Replies!

Date formatting

hello! i've got such values in the table: 1157012562. how to extract rows say for current month and current year PS i always dealt with ISO date format before and really stuck with NULL results i'm heaving using UNIX_TIMESTAMP() and YEAR() functions...
VIEWS ON THIS POST

183

Posted on:

Wednesday 24th October 2012
View Replies!

Row Type to keep formatting

I am writing an app for our school newspaper to be posted online. I want to store everything in my MySQL db, but also want to keep the formatting when we put the articles in the DB. What should the row type be for this in order to keep the formatting (paragraphs mainly). Text puts it all together... Basically articles will be copied out of word into a field and I would like to eliminate the need to build in a WYSIWYG editor if possible... I appreciate your help!
VIEWS ON THIS POST

116

Posted on:

Wednesday 24th October 2012
View Replies!

difficulty formatting time value

Currently when I search for this, sitepoint returns a blank page. And I couldn't see it in the mysql docs. I have a time col with times stored as 04:30:00 Please can anyone help in how to format this to 4.30am and of course, to show pm, if appropriate. bazz
VIEWS ON THIS POST

126

Posted on:

Thursday 25th October 2012
View Replies!

Delete query date formatting

I have several queries that I need to run that delete records based on a date field. One of the queries is Code: DELETE FROM `tbl_trade_accept_ctoons` WHERE `trade_id` in (select trade_id from tbl_trade_accept where accepted_date < '2009-02-14*'); However, the 'accepted_date' field saves values as the long timestamps like "1234571139". In the current setup, it always comes up with 0 records. How do I modify my query to be able to find the dates I want to clear out is the field it needs to target is formatted differently
VIEWS ON THIS POST

54

Posted on:

Monday 29th October 2012
View Replies!

Reformatting the date column?

OK so I know all about DATE_Format() but... is there a way i can alter my column in the table instead of being yyyy-mm-dd it is mm/dd/yyyy or mm-dd-yyyy like change it from datetime to date or setting some other parameter I am not sure if I am being clear, but basically i don't want to format the date after retrieving it, can I somehow set the source to the right format , Quote: Originally Posted by draelon You could store the data as a VARCHAR field, but the benefits of storing it as a date and reformatting it far out weigh the negatives of having to reformat the date. got it,
VIEWS ON THIS POST

54

Posted on:

Monday 29th October 2012
View Replies!

How to select daily rate between start and end dates?

I am working on a reservation application and am trying to figure out how best to store rate information in the database. Ideally a start and end date and the rate will be entered for that range. My problem is in how to select the rate for each day entered It is possible there will be different rates for some of the days in the range queried. For example, in the database we have the following rate information: START END RATE 3/1/2009 3/10/2009 50 3/11/2009 3/20/2009 80 How do I return the rate for each day for a query which spans both ranges If I searched for rates from 3/9/2009 through 3/12/2009 I should get the following results: 3/9/2009 - 50 3/10/2009 - 50 3/11/2009 - 80 3/12/2009 - 80 What should my sql statement look like to do this Would it also be possible to get the rates, and then calculate the average, all in one sql statement Thank you for your time and help!!!
VIEWS ON THIS POST

97

Posted on:

Monday 19th November 2012
View Replies!

Query to calculate Cumulative amt till date

Hi , I have a table where I have 2 fields as shown below: Amt TranDate ------ -------------- 10000 10-01-2008 2000 12-01-2008 4000 21-01-2008 -3000 31-01-2008 3500 15-02-2008 -3200 28-02-2008 1500 16-03-2008 -3800 31-03-2008 -3600 30-04-2008 500 15-05-2008 Now my requirement is to get the result-set in the following manner Amt TranDate Cumulative_Till_Date ------ -------------- -------------------- 10000 10-01-2008 10000 2000 12-01-2008 12000 4000 21-01-2008 16000 -3000 31-01-2008 13000 3500 15-02-2008 16500 -3200 28-02-2008 13300 1500 16-03-2008 14800 -3800 31-03-2008 11000 -3600 30-04-2008 7400 500 15-05-2008 7900 Kindly help me with this query.
VIEWS ON THIS POST

67

Posted on:

Monday 19th November 2012
View Replies!

SELECT a list of dates between range? Stored procedure?

I am new to stored procedures. I found and modified the code below, but I'm not sure how to actually select the dates from it, or if it really does what I want it to do. Ideally, I'd like to SELECT the dates in a range. so '1/1/2001' and '1/4/2001' would give me: Code: 1/1/2001 1/2/2001 1/3/2001 1/4/2001 Code: CREATE PROCEDURE dbo.dateRange @beginDate SMALLDATETIME, @endDate SMALLDATETIME AS BEGIN DECLARE @counter INT DECLARE @difference INT DECLARE @begin SMALLDATETIME DECLARE @end SMALLDATETIME DECLARE @weekno INT SET @begin = @beginDate SET @end = @endDate SELECT @difference = DATEDIFF(day, @beginDate,@endDate) SET @counter = 0 WHILE @counter < @difference BEGIN SET @counter = @counter + 1 BEGIN SET @weekno = DATENAME(week,DATEADD(day,@counter,@beginDate)) END END END GO
VIEWS ON THIS POST

53

Posted on:

Monday 19th November 2012
View Replies!

Update multiple rows

Hi , I have a product table which has 3581 records. Recently A colomn has been added to my needs. It works perfectly. But the issue is that 3521 of the prior records are labeled as NULL. I know that I should escape from NULL's as much as possible. so I tried changing it using following statement which does not properly function. Code: IF (SELECT * FROM Products WHERE CustomField5 IS NULL) >0 BEGIN UPDATE Products SET CustomField5 = 0 END Any idea how to change 3521 NULL values to '0' \t
VIEWS ON THIS POST

187

Posted on:

Monday 19th November 2012
View Replies!

Update based on a different table

I have two tables: micros.dev_def and micros.lan_node_def The important columns and values are: micros.dev_def - obj_num = 100 lan_node_seq =
VIEWS ON THIS POST

60

Posted on:

Monday 19th November 2012
View Replies!

How to ensure the same date formats?

I am designing a Web system (using ASP and MS SQL Server 2000) where it allows users to search for data in a range of dates (eg: From Date1 To Date2). In the MS SQL Server 2000 database, I used the function getDate() for the Date column. The format is such : mm/dd/yyyy hh:mm:ss AM/PM Users searches for data by inputting the range of dates in this format : mm/dd/yyy. When I run the SQL statement (search by a range of dates), I am not able to view any data from the database (even though the data actually existed in it). Code: SELECT * FROM tb_PI WHERE DateLog >= '4/7/2006' AND DateLog
VIEWS ON THIS POST

45

Posted on:

Monday 19th November 2012
View Replies!

Update data from another table

hi: i have 2 tables. t1 and t2. im trying to insert data in a field in t1 from a field in t2. the field is called F. t1 has data in its other columns but empty in the F. thats why i want to insert the data from t2 to t1 in the respective column F. i wrote the below code: UPDATE T1 SET F= ( SELECT F FROM T2 WHERE T2.Key = T1.KEY) i get this error: ORA-01427: single-row subquery returns more than one row kindly help me. where am i going wrong
VIEWS ON THIS POST

46

Posted on:

Monday 19th November 2012
View Replies!

oracle - compare date

hi, help needed! i'm doing a vb.net project! i use MS Access as my database at the beginning. so i use:- Code: CDate(valid_date) < # " & DateTime.Now.ToString("dd/MM/yyyy") & "# to get some record that the valid_date is < than today date! it work well when using MS Access. (NOTE: data type for valid_date is in VARCHAR not in Date) but when my move my database to Oracle. it has a problem! i cannot use the CDate function. an error as below occur! One or more errors occurred during processing of command. ORA-00911: invalid character 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.OleDb.OleDbException: One or more errors occurred during processing of command. ORA-00911: invalid character so any help can be provided regarding compare the date when database is store in Oracle! regards; charlotte
VIEWS ON THIS POST

89

Posted on:

Monday 19th November 2012
View Replies!

add the value of request.form to table field using update query

how can i add the value from request.form to the values in the database field Code: strSQL = "UPDATE Attempts Set " strSQL = strSQL & "Hours =" & Request("hours") & "," strSQL = strSQL & "Minutes =" & Request.form("minutes") & "," strSQL = strSQL & "Seconds=" & Request.form("seconds") & " strSQL = strSQL & " WHERE (StudentID ='" & studentID & "')" strSQL = strSQL & " AND (Paper ='" & Paper & "')"
VIEWS ON THIS POST

79

Posted on:

Monday 19th November 2012
View Replies!

need to modify date format in a table

I am wondering how (if at all) with Oracle/SQL i can modify a column of a table to have a different format, ie. there is a column DATE with format 04-JUN-99 (which is obviously DD-MON-YY) but i need this format to be changed (altered/updated) to format: Month DD, YYYY... can someone plz help me
VIEWS ON THIS POST

83

Posted on:

Monday 19th November 2012
View Replies!

smalldatetime, group by date

I have a logData columnt that is smalldatetime format. The prolem I'm having is that I want to group by just date. but I don't know if thats possible. Because this is time associated with it, it doesn't group the results by just date when I put this statement. SELECT COUNT(userId), logDate as pageViews from qcLogPage Group By logDate Is it possible to do it just by date
VIEWS ON THIS POST

56

Posted on:

Monday 19th November 2012
View Replies!

Updating datetime value with NULL

I'm trying to figure out how to insert a NULL value into a datetime column that already contains a date. The column contains NULL values by default before a date is inserted into it, but how can I insert NULL back into it
VIEWS ON THIS POST

202

Posted on:

Monday 19th November 2012
View Replies!

query date field

I have a table that is a log of user names with time and date fields of when they login. I'm wanting to display the first date and last date they loged in on all users in a table view. How would I SELECT DISTINCT Table2.fldUserName. and the fldDate
VIEWS ON THIS POST

147

Posted on:

Tuesday 20th November 2012
View Replies!