» How to SELECT * INTO [temp table] FROM [stored procedure]
How to SELECT * INTO [temp table] FROM [stored procedure]
|March 17, 2009
Posted by forumadmin
How do I do a
SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [temp table]?
Select all data from BusinessLine into tmpBusLine works fine.
select * into tmpBusLine
Trying the same, but using a stored procedure that returns data, is not quite the same.
select * into tmpBusLine from
exec getBusinessLineHistory '16 Mar 2009'
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword
I have read several examples of creating a temporary table with the same structure as the output stored procedure, which works fine, but it would be nice to not supply any columns.
I am using SQL Server 2005.
More Related Questions
- SQL Server – pull X random records per state I have a table with records for each zip code in the united states. For the purposes of displaying on a map, I need to select X random records per state. How would I go about doing […]
- How can I do an UPDATE statement with JOIN in SQL? I need to update this table in MS SQL Server 2005 with data from its 'parent' table, see below:
- How do I create unique constraint that also allows nulls in sql server Adding a column to table, and I want a unique constraint, so the column will insert GUID's, but to allow for existing data before column was added, I need to allow for NULL's in the […]
- Function vs. Stored Procedure in SQL Server I've been learning Functions and Stored Procedure for quite a while but I don't know why and when I should use a function or a stored procedure. They look same to me, maybe because I am […]
- How to append to a text field in t-sql SQL Server 2005 What is the best way to append to a text field using t-sql in Sql Server 2005?
With a varchar I would do this.
update tablename set fieldname = fieldname + 'appended string'
But this […]
- SQL update query using joins I have to update a field with a value which is returned by a join of 3 tables.
,im.sku as iSku
,gm.SKU as GSKU
,mm.ManufacturerId as ManuId
- MSSQL: How do you script Stored Procedure creation with code? I am trying to query for a list of stored procedure definitions using information_schema.routines that exist in one database but not in another.
- TSQL Finding Order that occurred in 3 consecutive months Please help me to generate the following query. Say I have customer table and order table.
- select max date and min date Have table like :
user_id Date Status
1000 2013-04-02 11:46:10.000 IN
1001 2013-04-02 11:50:08.000 OUT
- TSQL Inner Select with SUM I am trying to get the sum of 2 values in my inner select but get an error about the aggregate function.
I am just trying to understand how I need to format this differently to get it […]