What special character is better for text search?

I am using Sql Server 2014 Express and have a varchar(max) column. I some cases I need to use an special character to give special meaning to this field. I have for example this value: “123.456.234”, but I would like to use something like that: “678.*789.123”. In this second case the * has the meaning […]

How do I propagate NULL values in a custom expression?

I currently have a query on the following form: SELECT CASE WHEN <column> IS NOT NULL THEN <expression> ELSE NULL AS <new_column>, CASE WHEN <other_column> IS NOT NULL THEN <other_expression> ELSE NULL AS <new_other_column>, — etc… I’m thinking that it must be possible to rewrite the CASE statements as something that’s easier to read, with […]

Selecting column as unique value sql server

I have a table in MS SQL Server “MyTable” like below – PkId | Title | Some Column ———————————————– 1 | User 2 | Some value for “User 2” ———————————————– 2 | User | Some value for the user ———————————————– 3 | User | Some value for the user ———————————————– 4 | Admin | Some […]

Is there any way let SSMS remember the Save or Save As folder?

Anytime I create a new script and click Save, SSMS ‘Save File As’ dialog defaults to folder C:\Users\MyUserName\Documents\SQL Server Management Studio, and offers to save my file to there. It takes 3-8 clicks and at least 5 seconds to browse the folder I would like to really save my script. Within a time range when […]

How to calculate attrition rate in SQL

The table structure is userID – unique ID Billing Month – Month that bill was paid The data which I have is for 1 year or 12months I have to calculate the total number of users who are leaving each month. Thanks in advance.

SQL alchemy is slow in concurrent connection

I’m using Sql alchemy with Sql Server as database engine. I have queries that take long time (approximately 10 second). When I send concurrent requests to database, the response time takes more (Exactly, time = execution time * requests count). I Increased the connection pool but no changes have been happend.

how to allow user to take backup of database

I am building project using asp.net and sql server. It is 3 tier application. I want to give facility for the admin user to take backup of the database. the database should be downloadable from browser. for this i was using backup query in sql server. which places the backup of the database at server […]

Configure Jenkins to restore DB to a known dataset before running MsTest application

I have a MsTest project configured in Jenkins to test a ASP.Net MVC application. And it’s working fine. What I need to do is, Need to restore a SQL Server database which is located on a different server that use by the MVC application, before I run the MsTest project on Jenkins. So Can I […]

Converting a PeriodStart and PeriodEnd to year + week number

I’m trying to convert a start + end date into multiple rows filled with weeknumbers and the year connected to it. My idea is to convert this start + end date in SSIS with a Script component, and create rows for each week by setting SynchronousInput to ‘None’. I tried using a Timespan for this […]


I’m using MS SQL 2008 R2 (10.50.1600) I wonder why my database which is very tiny (nearly 1200 rows, only 2 tables) is restoring so slow (12-15 sec). I suppose it’s involved with log file within database (I’m not sure). The thing is I don’t care about the log file. I’m interesting in only with […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.