Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert current date CF & MS SQL

LEGEND ,
Jan 24, 2007 Jan 24, 2007
I am attempting to update a field with a current date using cfquery and SQL.
How can I do this? I tried (CurrentDate()) and Now(). The field is set to
SmallDate. Thanks!

UPDATE [Moot Court Invitation]
SET [invite?] = 1
[invitation date] = #Now()#
WHERE peopleid = '#arguments.pcode#'


TOPICS
Advanced techniques
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 24, 2007 Jan 24, 2007
since you're using SQL Server, just use getDate(). it's the built in SQL Server function (the equivelant of CF's now()).

SET [invite?] = 1, [invitation date] = getDate()
WHERE peopleID = ...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 24, 2007 Jan 24, 2007
in mssql, I believe the name of the function is getdate.

If you want to use the cold fusion function, now(), you also have to use either cfqueryparam or createodbcdate.

Is your peopleid field char or numeric. If numeric, lose the quotes.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 24, 2007 Jan 24, 2007
Even funnier, both work just fine IF you add a comma after the prior column
name and value... opps.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 24, 2007 Jan 24, 2007
Wally Kolcz wrote:

> UPDATE [Moot Court Invitation]
> SET [invite?] = 1
> [invitation date] = #Now()#
> WHERE peopleid = '#arguments.pcode#'

btw those are awful column names.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 25, 2007 Jan 25, 2007
LATEST
You have no idea how bad they actually are. 🙂


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources