Ellen
(Ellen )
September 13, 2023, 6:32am
1
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.
adiijaiin
(Aditya Jain)
September 13, 2023, 6:41am
2
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.
Ellen
(Ellen )
September 13, 2023, 6:54am
3
why to do this step ?
is it because SQL wont get that?
Ellen
(Ellen )
September 13, 2023, 6:33pm
4
I found the answer and it’s getting currentdate in column.
CONVERT (date, SYSDATETIME())
system
(system)
Closed
September 16, 2023, 6:33pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.