Tag Info

Hot answers tagged

4

The SELECT ... INTO syntax is only for new tables. I think you want: INSERT dbo.TableB ( <column list> ) SELECT <column list> FROM dbo.TableA WHERE ID IN ( SELECT ID FROM dbo.TableC ) ;


2

You asked "why this is taking too long?". You also said "Unfortunately, this took more than 5 seconds to retrieve the data and show them to me". Also, you reported the profiling output of your query. As you can see yourself, the sum of times reported by the profiler for each steps count to 0.000154 seconds. So, from the point of view of the profiler, the ...


1

Did you try chaining your WITH statements together? N.B. This may not be the most-optimal method of solving this problem, but should work based on your existing approach CREATE VIEW dbo.MyViewName AS WITH R(N) AS ( SELECT 0 UNION ALL SELECT N+1 FROM R WHERE N < 12 ), MonthYears AS ( SELECT ...


1

Please create the following index ALTER TABLE movie.movies ADD INDEX sid_mgid_ndx (s_id,mg_id); This index will help the WHERE and GROUP BY Perhaps a different index would help ALTER TABLE movie.movies DROP INDEX sid_mgid_ndx, ADD INDEX sid_mgid_id_ndx (s_id,mg_id,id) ; and adjust the query SELECT SQL_NO_CACHE m.id, m.sku, m.movie_url FROM ...


1

The easiest way I know of is creating a table in tempdb with a single column (id for instance), then expand the tempdb node in SSMS and find the table. Right click and select "Edit top 200 rows". A grid will appear. Select the whole first row with the row header on the left, then paste the whole contents of the file. BCP is an alternative way to load the ...



Only top voted, non community-wiki answers of a minimum length are eligible