Questions tagged [select-into]

The SQL command SELECT INTO statement copies data from one table into a new table. See https://www.w3schools.com/sql/sql_select_into.asp

SELECT INTO is available in various database systems so please tag the type of database being used as well.

158 questions
-1
votes
1 answer

Creating stored proc for select into statements

I am loading multiple tables by using Select into statments. Now, I need to create a job that runs everyday. My syntax goes like that: drop table select * into from so what it will do, it will drop tables everyday and create them again. This…
Stephanie
  • 496
  • 7
  • 26
-1
votes
1 answer

Select into and Join Problems

My problem stems from this: VBA (Excel) vs SQL - Comparing values in two rows (loop) I've modified the script a tad and it looks like this: ;WITH data AS ( SELECT a.i, a.M, b.M as NextM, CASE WHEN a.M = 65 AND b.M = 120 THEN 1 ELSE 0 END…
akwarywo
  • 187
  • 1
  • 2
  • 11
-1
votes
3 answers

SQL query data join has null values that it ignores

I have a table in SQL Server that contains a column for a ledger code that is linked to the ledgercode table via keyfield. Currently the column displays the keyfield value instead of the code number I used this query to create a new table: SELECT…
developthestars
  • 185
  • 1
  • 12
  • 27
-2
votes
1 answer

Oracle execute immediate

Have oracle stuff that I can't figure out where is the problem, if you could help me out here ORA-00911: invalid character ORA-06512: at line 20 Line 20 is EXECUTE IMMEDIATE SQL_STMT INTO P_COUNT USING L_RB_OD, L_RB_DO; I have like 10-15 tables,…
Veljko89
  • 1,813
  • 3
  • 28
  • 43
-2
votes
1 answer

T-SQL select into temp table does not have correct result

-- This Result Is Right and work correctly: SELECT AutoId, Name,[Group],[Priority], SUMCalculatedPercent FROM (SELECT DISTINCT *, ROW_NUMBER() OVER ( PARTITION BY [Group] ORDER BY SUMCalculatedPercent DESC,[Priority] ) AS ranker FROM…
A.J
  • 139
  • 1
  • 1
  • 10
-2
votes
1 answer

Join 3 tables INTO 1 new table

Table A = Clarity (uniqe ID = CaseID; contains CSN) Table B = Survey (unique ID = CSN) Table C = QA (unique ID = caseID; contains CSN) Table D = FullData Goal: “TableD” contains: all “TableC”, all “TableA” for which there is a “CaseID” and “CSN” in…
JoshuaB
  • 29
  • 8
-2
votes
1 answer

select into oufile does not work

Why would the following query appear to run but I never can find the file outfile? select * INTO OUTFILE 'outfile.csv' FIELDS TERMINATED by ',' LINES TERMINATED BY '\n' from nGrams I have MySQL 5.5 and I am running…
CodeKingPlusPlus
  • 15,383
  • 51
  • 135
  • 216
-5
votes
2 answers

Select into without touching the autoincrement ID field

I want to migrate data from one table to another without copying the autoincremented ID field. source_table: ID LABEL -- ----- 5 text 6 text2 dest_table: ID LABEL -- ----- SELECT LABEL INTO dest_table FROM source_table Will the above…
Adel Boutros
  • 10,205
  • 7
  • 55
  • 89
1 2 3
10
11