Skip to content
Advertisement

Tag: sql-server-2008

How to replace first and last character of column in sql server?

I have a database column and its give a string like ,Recovery, Pump Exchange,. I want remove first and last comma from string. Expected Result : Recovery, Pump Exchange. Answer You can use SUBSTRING for that: Obviously, an even better approach would be not to put leading and trailing commas there in the first place, if this is an option.

How to find last weekday of current month using SQL

How would I calculate the last weekday of the current month given a date using SQL? I was able to get the last day of current month, but not sure how to do the last weekday programmatically. I don’t want to generate a calendar look-up table. Here’s the last day of month code i’m currently using: Answer I know it

Advertisement