Discussion Locked

No "PassThru" SQL-ASP

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How to construct the opposite of "PassThru" SQL in ASP? i.e. the run time must execute only standard ASP functions.

Eg: the RDBMS has constructs like

Conn. Str="Select date_part('year', dtFieldName) as X from tblHavingDateField"

while I need to work it with
Conn.Str="Select date(dtFieldName) as X from tblHavingDateField".

In general, is there any flag to tell the system that I want to execute only ASP code? If possible, where do I plug this in? In the driver, provider?. Is it possible?.

I don't want to write parsers or custom controls.

End of question

5 replies

by quahsays

if the field is a datetime field in the database, you can simply SELECT that column, and in ASP, you can get the year using year(dtFieldName).

by ananthap

Probably I could have clarified more but I do think most people got the point.

I HAVE TO (for certain reasons not connectedwith the syntax) use the data_part function. But it makes my code non-portable.

But A for effort. Keep it coming.

End of mail.

by nfedin

In you SQL string, use this MS SQL Server function to modify the returning date. Just replace "getdate()" with you date field. This will return a date in MM/DD/YYYY format.

(convert(char(10),getdate(),101))

This discussion is closed to new replies.