245 Answered Questions for the topic SQL
Sql
04/25/19
How do you return the column names of a table?
How would I return the column names of a table using SQL Server 2008? i.e. a table contains these columns- id, name, address, country and I want to return these as data.
Sql
04/24/19
SQL statement to get column type?
Is there a SQL statement that can return the type of a column in a table?
Sql
04/24/19
Duplicate row based in column value?
Please I need to duplicate row when having multiple values in one column.
Exemple :
A B 12 I76J-I76H=>
A B 12 I76J
A B 12 I76H
Thank you .
Sql
04/23/19
Does MS SQL Server's "between" include the range boundaries?
For instance can
SELECT foo
FROM bar
WHERE foo BETWEEN 5 AND 10
select 5 and 10 or they are excluded from the range?
Sql
04/23/19
Difference between read commit and repeatable read?
I think the above isolation levels are so alike. Could someone please describe with some nice examples what the main difference is ?
Sql
04/22/19
What is the difference between JOIN and UNION?
What is the difference between `JOIN` and `UNION`? Can I have an example?
Sql
04/22/19
How do I update if exists, insert if not (AKA "upsert" or "merge") in MySQL?
Is there an easy way to `INSERT` a row when it does not exist, or to `UPDATE` if it exists, using one MySQL query?
Sql
04/22/19
How to create a table from select query result in SQL Server 2008?
I want to create a table from select query result in SQL Server, I tried
create table temp AS select.....
but I got an error
> Incorrect syntax near the keyword 'AS'
Sql
04/21/19
What is the benefit of using "SET XACT_ABORT ON" in a stored procedure?
What is the benefit of using **`SET XACT_ABORT ON`** in a stored procedure?
Sql
04/20/19
SQL server query to get the list of columns in a table along with Data types, NOT NULL, and PRIMARY KEY constraints?
I need to write a query on SQL server to get the list of columns in a particular table, its associated data types and their length and if they are not null. I have managed to do this much. But now...
more
04/20/19
Do I need to call rollback if I never commit?
I am connecting to a SQL Server using no autocommit. If everything is successful, I call commit. Otherwise, I just exit. Do I need to explicitly call rollback, or will it be rolled back...
more
04/20/19
Maximizing Code Performance for Shapely?
I've written this code in order to calculate the percent cover of grassland within a national park, within 20km^2 of points of recorded occurrences for a species. It is designed to only consider...
more
Finding strings that differ with at most one letter from a given string in SAS with PROC SQL?
First some context. I am using proc sql in SAS, and need to fetch all the entries in a data set (with a couple of million entries) that have variable "Name" equal to (let's say) "Massachusetts". Of...
more
Sql
04/19/19
What is the difference between "INNER JOIN" and "OUTER JOIN"?
Also how do `LEFT JOIN`, `RIGHT JOIN` and `FULL JOIN` fit in?
Sql Sas
04/17/19
SQL/SAS: Best performance for selecting from big table (2bn rows)?
I have a non-indexed 2 billion rows table in a read-only SAS SPD server (**bigtable**). I have another 12 million rows table in my workspace (SAS_GRID) with a single column of unique ids...
more
Is it possible to do a case-insensitive DISTINCT with SAS (PROC SQL)?
Is there a way to get the case-insensitive distinct rows from this SAS SQL query? ...
SELECT DISTINCT country FROM companies;
The ideal solution would consist of a single query.
Results now...
more
Sql
04/15/19
Modify table: How to change 'Allow Nulls' attribute from not null to allow null?
How to change one attribute in a table using T-SQL to allow nulls (not null --> null)? Alter table maybe?
Sql
04/14/19
Authenticate soap request in postman for SSRS?
How do I add authentication to a SOAP request body in postman to receive back an XML response for SSRS web services?
Sql
04/14/19
What is the simplest SQL Query to find the second largest value?
What is the simplest SQL query to find the second largest integer value in a specific column?
There are maybe duplicate values in the column.
Sql
04/14/19
Most efficient T-SQL way to pad a varchar on the left to a certain length?
As compared to say:
REPLICATE(@padchar, @len - LEN(@str)) + @str
Sql
04/12/19
Why is SELECT * considered harmful?
Why is `SELECT *` bad practice? Wouldn't it mean less code to change if you added a new column you wanted?
I understand that `SELECT COUNT(*)` is a performance problem on some DBs, but what if you...
more
04/12/19
Insert Geography data into SQL Server 2008?
Can someone guide me to or give me an example on how would one go about insert/query Geography data in Sql Server 2008 ( Polygon with 4 points and Point in specific) using C# EF or Linq2Sql.
I've...
more
Sql
04/12/19
How to concatenate text from multiple rows into a single text string in SQL server?
Consider a database table holding names, with three rows:
Peter
Paul
Mary
Is there an easy way to turn this into a single string of `Peter, Paul, Mary`?
Sql
04/12/19
NOT IN operator for filter in dataset SQL Server Reporting Services 2016/Report Builder 3?
Does anyone know how to do "NOT IN" as the operator for a filter in a dataset?
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.