Date problem with SQL Server

Date problem with SQL Server

Post by nntp.wits.ac.z » Tue, 16 Jan 2001 18:55:26



Hi,

In my web application I have a table which holds a "Last updated" column.

Initially the database was an Access one , but was later upscaled to SQL
Server. The "Last updated" column's datatype in Access was date/time.

In my program I fill in this entry by using the vbscript function Date.
When I look at the actual tables I see that the correct date gets placed
here.

Heres my problem:
I have another page on my site where I display the date when this entry was
last updated.
I use a query something like
SELECT *,convert(varchar(1000),Information) as Information FROM Schools
WHERE SchoolId='" & myid

The problem is that this "Last updated" entry comes out blank.  I'm sure
that I need to somehow use a convert statement with a SQL server datetime
datatype, but how ?

 
 
 

Date problem with SQL Server

Post by Andrey Pridni » Thu, 18 Jan 2001 11:56:42


You can try this:

SELECT Schools.*, cast(Information as varchar(11)) as Information FROM Schools
WHERE SchoolId='" & myid


> Hi,

> In my web application I have a table which holds a "Last updated" column.

> Initially the database was an Access one , but was later upscaled to SQL
> Server. The "Last updated" column's datatype in Access was date/time.

> In my program I fill in this entry by using the vbscript function Date.
> When I look at the actual tables I see that the correct date gets placed
> here.

> Heres my problem:
> I have another page on my site where I display the date when this entry was
> last updated.
> I use a query something like
> SELECT *,convert(varchar(1000),Information) as Information FROM Schools
> WHERE SchoolId='" & myid

> The problem is that this "Last updated" entry comes out blank.  I'm sure
> that I need to somehow use a convert statement with a SQL server datetime
> datatype, but how ?


 
 
 

1. Date problems between SQL-Server 7.0 Stored Proc and VB.

I have several fields, which are defined as DateTime datatypes in
SQL-Server. I can insert data into this fields using the adDBTimeStamp
datatype in Visual Basic 6.0 (SP 4).

The problem comes when I try to update these fields. For some reason, even
when I have the fields defined as adDBTimeStamp in VB, they will not update.
I do not get an error, the fields just do not change values.

Any ideas?

Thanks!

2. ER/HDR can they mix?

3. Date Problems with SQL Server 6.5

4. Looping and Adding a number to a String

5. Date problems in sql server 2000

6. Define Field newbie ??

7. Date problems with SQL Server 7.0

8. SQL 7 Maintence Plans

9. Date format problem. SQL server and IIS

10. Please Help: Need SQL Server ODBC client v3.60.x to correct a date problem

11. URGENT: Problem inserting accented dates in FRENCH SQL-Server 6.5 setup

12. date format problem in IIS & Sql Server

13. Please Help: Need SQL Server ODBC client v3.60.x to correct a date problem