0

I have a data extension (Name: Factura_T_Alex) with a single primary key (Name: NrFactura) and an attribute (Name: DataEmitere) which is a DateTime type. I need only the date part to use in a script so I created a Text type attribute (Name: DataEmitereText) in which I want to save only the date from DataEmitere so I wrote the folowing SQL Query:

SELECT
NrFactura,
CONVERT(varchar, DataEmitere, 101) AS DataEmitereText
FROM [Factura_T_Alex]

and IT WORKS!

But the targeted data extension for this is the same data extension I'm using in the SQL Query Activity, Factura_T_Alex, as seen in the image below.

SQL Query

My question is: Can I do that? Can I use the target data extension to update it's own fields in SQL and be sure that nothing will go wrong here? Like a field being written with the wrong value?

  • 1
    It would be much easier if you just converted the date using a dedicated function in your script - which scripting language are you using and what is the desired format of the date? – zuzannamj Aug 28 at 14:28
  • I'm already doing that. The script is complex and the DE has around 600k records, so I need the new text field to filter the records in the script to get only the records I need that day (around 50k per day). – Alex Aug 28 at 14:50
0

Going from your reply, you only need records for a certain day.

You could add the following WHERE-clause to your SQL query without the need to convert your date field:

WHERE Date(DataEmitere) = DATE(today())

For performance reasons, I would not recommend to convert your date field to text if you want to filter on it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.