I have a wildcard search that I need to improve performance: mycolumn like ‘%-%%-%’ There is a way to do that? (for exemple, with Full-Text Index?) Obs: I have to find dates in my text that follows the pattern, like 21-07-2016. EDIT I have a legacy database that I cannot change the structure. So, I […]
I am relatively new to SQL and I may be over thinking it but given the following table.I want a list of all students that are enrolled in Chemistry but not Mathematics.So given the data I would have Student 1. Student_ID Subject 1 Chemistry 2 Mathematics 2 Chemistry 3 History Here’s what I tried SELECT […]
If I want to join two tables (not inner join), Left table has huge data (millions of record), and right table has few records. What should I prefer (Left or Right Outer join) and why.
I am using an update join query to update some records. I am actually joining an indexed table to itself, and updating where a pattern is met. This query worked fine for about a million records, but with 14 million records it just doesn’t scale. The reason I am doing it this way is because […]
I have a table that stores schedules by initial hour to end hour, some structure like | SCHEDULE_NAME | START_HOUR | END_HOUR | | ————- | ————- | ——— | | Morning Shift | 8:00 | 10:00 | | Evening Shift | 13:00 | 17:00 | | Night Shit | 22:00 | 2:00 | So […]
In my program I want the user to have the option to change the value (price in my example) in a local database, that I created. I’m having a problem with it. The connection works fine and it debugs well and even shows the message that “saving ok”, but it doesn’t change at all in […]
I want to get the count of rows from a table based on a specific criteria for each column in my result table. The table itself is a temporary table. The query below is what I want to accomplish but I don’t know what is the syntax to get to it: WITH table1 as( a […]
I have a table in csv file (with an ID as numeric). I manually uploaded the information from the file to a SQL Server data table (creating my ID column as numeric). But, I want to recreate my ID column as autonumeric ID column that continue the number with the latest entry. Example: the table […]
I got a dataset in SQL Server Management Studio. The data looks like the following month Year ————- Feb 2016 Jan 2015 I want to create a numeric date using 01 as dd. I tried CAST(’01-‘+ month +’-‘+ year AS DATE) also CONVERT(DATETIME, ’01-‘+ month +’-‘+ year, 106) AS Both of them cause this error: […]
I’m working with SQL Server Management Studio. I want to create a primary key like “3585c5d240dd4132bab35ab969137f3f” with a statement from SQL but I don’t know the statement to create a primary key. Can someone tell me what the statement is, to create a primary key like this?