Skip to content

Tag: sql-server

SQL – FOR XML – How to add property to tag

I have the a stored procedure to generate an XML document based on the UBL-TR-2.1 standard. This is the query where the xml data is generated: A sample output of this query is this XML file: This works so far so good. But now some XML elements shall have attribute in the element itself. One example is: How ca…

Find start date and end date from the employee time clock

I am trying to find out star date and end date for the employee time clock. Following is the example of the data I have. Output wanted: I have to find the start date and end date of the person based on eventtime and activitycode. The start date will be event time column and I have to calculate end date

Stuck on final SQL query

I’m busy creating a report and am stuck with how to structure the final query. I have a sub-query that returns the following result set I need the final query result to look like this: I know I can …