How to convert the output of sub query into numeric? It’s a little hard to tell without the concrete table definitions, but I’m pretty sure you’re trying to compare different data types to each other. If this is the case you can make use of the CAST or the CONVERT function, for example: SELECT [rptName] … Continue reading how to convert the output of sub query into numeric
this is much cleaner solution: SELECT — 17530101 or 1753-01-01 is the minimum date in SQL Server DATEADD(dd, ((DATEDIFF(dd, ‘17530101’, GETDATE()) / 7) * 7) – 7, ‘17530101’) AS [LowerLimit], — Last Week’s Monday DATEADD(dd, ((DATEDIFF(dd, ‘17530101’, GETDATE()) / 7) * 7) – 1, ‘17530101’) AS [UpperLimit] — Last Week’s Sunday. Which can be used … Continue reading SQL get last Monday and last Sundays date based on todays date
We can use update and replace methods to to change particular column value to another value in sql. But we need to be very careful when we run the update query. Always perform the select query and check the output. Then proceed with update query Assume if table column contains ‘I like ‘Calcutta’, you need to replace … Continue reading How to replace and update specific value in sql
Here is how to set unique constraint for a column in Microsoft SQL Server 2005, 2008 to 2012. Using SQL: See the full syntax here. In SQL Server Management Studio Express: Right-click table, choose Modify or Design(For Later Versions) Right-click field, choose Indexes/Keys… Click Add For Columns, select the field name you want to be unique. For Type, choose Unique Key. Click Close, Save the table.