I have some data that I would like to split based on a delimiter that may or may not exist. Example data: John/Smith Jane/Doe Steve Bob/Johnson I am using the following code to split this data into …
Tag: sql-server
Is it OK to swallow an exception for DB INSERT
Is it OK to swallow Duplicate key violation exceptions for INSERTS or should you check if the record exists? So let’s say that I have a table Photo with one field: PhotoName. I’m looking through a file directory to add items to Photo. In the process, it’s possible that when I find a photonam…
SQL Server Reporting Studio report showing “ERROR#” or invalid data type error
I struggled with this issue for too long before finally tracking down how to avoid/fix it. It seems like something that should be on StackOverflow for the benefit of others. I had an SSRS report where the query worked fine and displayed the string results I expected. However, when I tried to add that field to…
select NULL and false but not true in sql
i an new in vb.ner sql and what i am asking may be silly question. I have a table in sql server 2005 and a column name activated. this column contain NULL, true or false. I want to select only NULL …
MSSQL BIT_COUNT (Hammingdistance)
Is there any function similar to the MYSQL BIT_COUNT function in MSSQL? I want to create a very simple Hammingdistance function in MSSQL that i can use in my selects. Here is what i have for MYSQL: Answer Why not just write your own bit_count code in T-SQL? There’s no need to use SQL CLR if all you need…
Import data from Excel Wizard automatically detects data types
Hello I’m trying to import data from excel file (xls) to new SQL table so I use Import and Export data 32/bit to achieve that. When I load the excel file it automatically detects data types of columns. e.g. column with phone numbers is as data type to new table float and in excel is as Double(15) when I…
Stored Procedure Return Type Can Not Be Detected
I am trying to drag this procedure over to the dbml in VS 2012 and I am getting the return type cannot be detected message. I have tried these: LINQ to SQL – Stored Procedure Return Type Error The …
How to calculate running total (month to date) in SQL Server 2008
I’m trying to calculate a month-to-date total using SQL Server 2008. I’m trying to generate a month-to-date count at the level of activities and representatives. Here are the results I want to generate: From the following tables: ACTIVITIES_FACT table LU_TIME table I’m not sure how to do thi…
Month difference between two dates in sql server
Please refer the below examples and kindly let me know your ideas. Output = 3 expected output = 2.5 Since I have only 15 days in Nov, So I should get 0.5 for Nov Answer Try this OR
inflation calculation in MS SQL
I have the below requirement to fulfill. How to achieve this simplistically. There is an inflation rate table as below I need to first get And then get Answer I think the best way to do this on SQLserver is to use a common table expression with recursion. I’m not 100% sure because I can’t test it …