Insert data into a table using table variables and cross join
2015-04-29 22:20
441 查看
Declare @SSRSreportIDTable TABLE ( ID int ) Declare @UserNameTable Table ( username nvarchar(50) ) INSERT INTO @SSRSReportIDTable Select SSRSReportID FROM SSRSReport WHERE SSRSReport.[SSRSReportID] != 23 and SSRSReport.[SSRSReportID] != 24 INSERT INTO @UserNameTable select UserName FROM [users] where [Username] like '%@%' INSERT INTO UserToSSRSReport (UserName, SSRSReportID) select Username, id FROM @SSRSReportIDTable cross join @UserNameTable select * from UserToSSRSReport
相关文章推荐
- Azure Basic - Insert data into BlockBlob, Table and Queue (with Diagnostic + Azure Storage Explore)
- Read a File Using File Layout and insert data into a record
- how to select data in multiple datatables after using join,group by and order by in Linq
- that-annoying-insert-problem-getting-data-into-the-db-using-dapper
- Using Data and Variables
- Inserting and Creating Tables Using INSERT/SELECT INTO
- Insert Data into Sorted Table
- SQL SERVER – Insert Data From One Table to Another Table – INSERT INTO SELECT – SELECT INTO TABLE
- Read A Flat File Using File Layout And Insert Into The Specific Component Using CI ( Bulk Insert )
- java数据库编程——Insert and Retrieve Images from MySql Table Using Java
- Convert internal table data into HTML format without using Function Modules
- [bash]insert data into table
- SQL Server Insert data into table
- [SQL Server][FILESTREAM] -- Using INSERT, UPDATE and DELETE to manage SQL Server FILESTREAM Data
- ERROR InsertIntoHadoopFsRelationCommand: Aborting job. ...please set spark.sql.crossJoin.enabled
- SPARK SQL - update MySql table using DataFrames and JDBC
- Insert Data into Sorted Table
- How to Integrate SAP Business Data Into SharePoint 2010 Using Business Connectivity Services and LINQ to SAP
- Using and Understanding Java Data Objects
- Create country table and insert all the countries script for SQL Server