Skip to content

Tag: sql-server

How to make all combinations with given words in SQL

I’ll make a search query that search on each individual word contains in my table using SQL Server. The query must work as following situation: The query must search in the colour, style, marerial and shape field like an or operator The query must search on each individual search word (like blue, red, m…

insert xml data to table stored procedure sql server

I have xml in following format I want to insert them in table so the table should have 4 records in the example. columns are name and alias. How can I achive this using cursor or something else? What i have tried. In cursor for entity i try insert alias value,but only first alias is taken. Answer

VIEW – INDEX SQL SERVEr

Does anyone know another way to run the query below more efficiently? I’m using SQL Server 2014. I’m facing a problem if i create index on table or on view . On table 2 (TB_FATURA_ITEM_TRANSACAO_HST) , has stored 50 million rows . I was wondering using Schemabiding on View , but I was looking in s…

Adding a new column with data

Below is my table: Now I want to add a new column called ‘Gender’ with values M,M,M,F in 4 rows respectively. I first added a new column using: Now I understand I can add data one by one by using: But how do I add all 4 data at once? Answer You don’t, unless there is some other piece of

How to compare two strings based on percent match in SQL

I want to post a solution to a interesting problem I was facing in T-SQL. The problem: Compare two string fields based on a percent match. In addition, the two strings may have the words in them translocated. For example: “Joni Bravo” and “Bravo Joni”. These two strings should return a…