How to use REGEX patterns to return day of the week if a date is entered?

风流意气都作罢 提交于 2019-12-11 06:09:46

问题


I am trying to create something that will populate the day of the week in one cell based on a date entered in another, BUT in Master Data Services. I know I will need to do this in a business rule and apply it to the attributes. I am wondering if this can be don using REGEX patterns or any other clever method. So, for example if I have a column with 12/21/2016 in it, I want the next column to say "Wednesday". Thanks!


回答1:


The simplest way would be using sql and use a calculated column or directly in a view. I'm not that familiar with MDS so there might be a better solution (or not even possible).

alter table mytable add weekday as DATENAME(dw,fieldname) persisted

Do never try to do your own date/time functions, you will fail



来源:https://stackoverflow.com/questions/41273707/how-to-use-regex-patterns-to-return-day-of-the-week-if-a-date-is-entered

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!