Mathc SQL Column contains Date with current date

i’m adding data to SQL table and want to get some data out again.

Table has a column “created_date” which is filled when I’m done adding data to Table.

“created_date” has value in this format like: 2023-09-12 (just date no timestamp)

Now I want to get UserID out from that table where “created_date” is equal to current date…

I tried this query in SQL
SELECT [UserID] FROM YTable WHERE created_date = ‘2023-09-13’
it works but I dont want to add date manual.

SELECT [UserID] FROM YTable WHERE created_date = CURRENT_TIMESTAMP(‘YYYY-MM-DD’)

its not working…
so how can i change ‘2023-09-13’ with current date with just date and not time.

Hi @Ellen

If you are running it from the studio, please form the query first in a string variable.
for eg strQuery= “SELECT [UserID] FROM YTable WHERE created_date = '”+Now.toString(“yyyy-MM-dd”+“'”
and then pass this query using the variable.

why to do this step ?
is it because SQL wont get that?

I found the answer and it’s getting currentdate in column.

CONVERT (date, SYSDATETIME())

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.