XML Task And Variable Output?

Feb 20, 2007

Hello,



What I'm trying to do is get an XML query from a database and use the XML to render an excel document. Can this be done using SSIS? Can I actually read a column from a database and store it in a variable and then create an excel spreadsheet with that variable in SSIS? Would this be done in the control flow using the XML task editor?





Thanks,

Phil

View 5 Replies


ADVERTISEMENT

Trying To Set Output Variable To Row Count Result Of SQL Execute Task

Nov 5, 2007

I am building this as an expression, but it is not working. I am trying to return the row count into a variable to use later in an update statement. What am I doing wrong? I am using a single row result set. I have one variable defined in my result set. I am receiving an error stating: Execute SQL Task: There is an invalid number of result bindings returned for the ResultSetType: "ResultSetType_SingleRow". Any help is appreciated!

SELECT count(*) FROM hsi.itemdata a
JOIN hsi.keyitem105 b on a.itemnum = b.itemnum
JOIN hsi.keyitem106 c on a.itemnum = c.itemnum
JOIN hsi.keyitem108 d on a.itemnum = d.itemnum
WHERE a.itemtypegroupnum = 102
AND a.itemtypenum = 108
AND b.keyvaluechar = " + (DT_WSTR,2)@[User::Branch] + "
AND c.keyvaluechar = " + (DT_WSTR,2)@[User:epartment] + "
AND d.keyvaluesmall = " + (DT_WSTR,7)@[User::InvoiceNumber] + ")

View 6 Replies View Related

Execute Process Task -- Redirect Standard Output To A File, Not A Variable

May 29, 2007

I'm trying to use "findstr.exe" to extract some lines of interest from a data file, which I will later load to a table. I'd like to issue this form of a command:



findstr.exe "^SEARCHSTRING" "srcfile" > "dstfile"



I build the arguments using expressions, and both the search string and source file get correctly set. However, the ">" seems to be ignored--I can see the lines spitting out to the temporary window when I run under VS.



QUESTION: how do you redirect the output of a command run under an Execute Process Task?



View 3 Replies View Related

File System Task - Output File Variable Syntax????

Feb 7, 2007



Hi

This should be incredibly simple and easy, but I can't find any examples of how to do this.

I just want to make a File System Task move a file, and have the destination be filename + date and time. For example \serversharefilename02072007.txt

What syntax do I use in a variable to make this work?

Thanks

View 16 Replies View Related

Execute SQL Task – Output Parameter On Stored Procedure Causes Task To Fail.

Dec 2, 2005

I have a SQL Task that calls a stored procedure and returns an output parameter.  The task fails with error "Value does not fall within the expected range."   The Stored Procedure is defined as follows: Create Procedure [dbo].[TestOutputParms]             @InParm INT ,             @OutParm INT OUTPUT as Set @OutParm  = @InParm + 5   The task uses an OLEDB connection and has a source type of Direct Input.  The SQL Statement is Exec TestOutputParms 7, ? output    The parameter mapping is: Variable Name Direction Data Type Parameter Name User::OutParm Output LONG @OutParm  

View 7 Replies View Related

SSIS Script Task Alters Package Variable, But Variable Does Not Change.

Oct 25, 2006

I'm working on an SSIS package that uses a vb.net script to grab some XML from a webservice (I'd explain why I'm not using a web service task here, but I'd just get angry), and I wish to then assign the XML string to a package variable which then gets sent along to a DataFlow Task that contains an XML Source that points at said variable. when I copy the XML string into the variable value in the script, if do a quickwatch on the variable (as in Dts.Variable("MyXML").value) it looks as though the new value has been copied to the variable, but when I step out of that task and look at the package explorer the variable is its original value.

I think the problem is that the dataflow XML source has a lock on the variable and so the script task isn't affecting it. Does anyone have any experience with this kind of problem, or know a workaround?

View 1 Replies View Related

Passing A SSIS Global Variable To A Declared Variable In A Query In SQL Task

Mar 6, 2008

I have a SQL Task that updates running totals on a record inserted using a Data Flow Task. The package runs without error, but the actual row does not calculate the running totals. I suspect that the inserted record is not committed until the package completes and the SQL Task is seeing the previous record as the current. Here is the code in the SQL Task:

DECLARE @DV INT;
SET @DV = (SELECT MAX(DateValue) FROM tblTG);
DECLARE @PV INT;
SET @PV = @DV - 1;

I've not been successful in passing a SSIS global variable to a declared parameter, but is it possible to do this:

DECLARE @DV INT;
SET @DV = ?;
DECLARE @PV INT;
SET @PV = @DV - 1;


I have almost 50 references to these parameters in the query so a substitution would be helpful.

Dan

View 4 Replies View Related

Variable Inside A Variable From Sql TAsk

Sep 28, 2006

I've got two Sql Tasks on my dtsx. The first one loads a value into "Proyecto" user variable and the second one executes a variable named "SegundoProceso" which contains from the beginning:

"select Fecha from LogsCargaExcel where Proyecto = " + @[User::Proyecto] +""
As SqlSourceType propety I have "Variable" and inside ResultSet or Parameter Mapping nodes there is nothing.

[Execute SQL Task] Error: Executing the query ""select Fecha from LogsCargaExcel where Proyecto = " + @[User::Proyecto] +""" failed with the following error: "Cannot use empty object or column names. Use a single space if necessary.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Where am I wrong?

TIA

View 12 Replies View Related

SQL Variable And IS Variable In Execute SQL Task

Jan 3, 2007

Hi,

 

I have an Execute SQL Task (OLE DB Connnection Manager) with a SQL script in it. In this script I use several SQL variables (@my_variable). I would like to assign an IS variable ([User::My_Variable]) to one of my SQL variables on this script. Example:

 

DECLARE @my_variable int

, <several_others>

SET @my_variable = ?

<do_some_stuff>

 

Of course, I also set up the parameter mapping.

However, it seems this is not possible. Assigning a variable using a ? only seems to work in simple T-SQL statements.

I have several reasons for wanting to do this:

- the script uses several variables, several times. Not all SQL variables are assigned via IS variables.

- For reading and mainenance purposes, I prefer to pass the variable only once. Otherwise every time the script changes u need to keep track of all questionmarks and their order.

- Passing the variable once also makes it easier to design the script outside IS using Management Studio.

- This script only does preparation for the actual ETL, so I prefer to keep it in one task instead of taking it apart to several consecutive Execute SQL Tasks.

- I prefer to use the OLE DB connection manager because it's a de facto standard here.

 

Could anyone help me out with the following questions:

- Is the above possible?

- If so, how?

- If not, why not?

- If not, what would be the best way around this problem?

 

Thanx in advance,

Pipo

View 6 Replies View Related

Output Parameter Vs (variable) = ?

Jan 18, 2006

Is there any benefit to using Output parameters:eg.[query set-up and execution goes here]

View 2 Replies View Related

Output Variable To Crystal From Sp

May 27, 1999

hey folks...
i am new to store procedures, crystal and sql server... ..one heck of a combination..yikes....neways.... writing a stored procedure in 6.5 to run a crystal report 7.0... want to create an output variable in the procedure that the report will see as a field... can i do this...and if so how....
any and all help muchos gracious.... the higher ups just don't get why i can't do all in 10 days of learning sp's on my own.... egads... management
:-)

take care.....kim

View 2 Replies View Related

Redirect The Output To A Variable

Mar 26, 2008

This is my stored procedure .It is working fine .I want to capture the output in a print statement .Can anyone help me please .

alter proc r (@id INT)

as

BEGIN

DECLARE @input VARCHAR(800)

DECLARE @c_input INT

DECLARE @i_Input INT

DECLARE @input_left VARCHAR(800)

DECLARE @delimiter CHAR(1)

select @delimiter = ','

DECLARE @in VARCHAR(800)

DECLARE @list VARCHAR(800)

declare @list2 VARCHAR(800)



SET @input = 'db2,oracle,sybase'

select @c_input = (select dbo.Fx_CharCount(@delimiter,@input))

set @c_input = @c_input + 1

while @c_input > 0

BEGIN

select @i_input = charindex(@Delimiter,@input)

if @i_input != 0

BEGIN

select @input_left = left(@input, @i_input - 1)

END

else

select @input_left = @input

select @in = '''' + @input_left + ''''

select @list = ISNULL(@list + ',', '') + @in

select @input = right(@input ,(len(@input) - @i_input))

SET @c_input = @c_input -1

if @c_input = 0 or @input = @input_left

break

end

Print @list

EXECUTE ('SELECT Label FROM systemtype WHERE Label Not IN (' + @list + ')')

END




my actual task is like this
My input is a list of values seperated by commas
now my output should be list of values not in the table joined by comma

eg : if my table consists of list of all databases like

db2
oracle,
sybase,
mssql,
mysql,



myinput would be like this db2,sybase,oracle
my output should be mssql,mysql
how to get that
?



Any suggestions

View 2 Replies View Related

Output To Be Redirected To A Variable

Mar 26, 2008

here's my code i want my output to be stored in a variable or out statement .Any suggestions on the below procedure

alter proc r (@id INT)
as
BEGIN

DECLARE @input VARCHAR(800)
DECLARE @c_input INT
DECLARE @i_Input INT
DECLARE @input_left VARCHAR(800)
DECLARE @delimiter CHAR(1)
select @delimiter = ','
DECLARE @inVARCHAR(800)
DECLARE @list VARCHAR(800)
declare @list2 VARCHAR(800)


SET @input = 'AWCA,GCS,IHP,Aetna'
select @c_input = (select dbo.Fx_CharCount(@delimiter,@input))
set @c_input = @c_input + 1
while @c_input > 0
BEGIN
select @i_input = charindex(@Delimiter,@input)
if @i_input != 0
BEGIN
select @input_left = left(@input, @i_input - 1)
END
else
select @input_left = @input

select @in = '''' + @input_left + ''''
select @list = ISNULL(@list + ',', '') + @in

select @input = right(@input ,(len(@input) - @i_input))
SET @c_input = @c_input -1
if @c_input = 0 or @input = @input_left
break
end

PRINT @list

END

View 7 Replies View Related

Dynamic SQL Variable With Output ??

Jul 23, 2005

I know this has been dealt with a lot, but I would still reallyappreciate help. Thanks.I am trying to transform this tableYY--ID-Code-R1-R2-R3-R4...R402004-1-101--1--2-3-42004-2-101--2--3-4-2....2005-99-103-4-3-2-1Into a table where the new columns are the count for 4-3-2-1 for everydistinct code in the first table based on year. I will get the yearfrom the user-end(Access). I will then create my report based on theinfo in the new table. Here's what I've tried so far (only for 1stcolumn):CREATE PROCEDURE comptabilisationDYN@colonne varchar(3) '*receives R1, then R2, loop is in vba access*ASDECLARE @SQLStatement varchar(8000)DECLARE @TotalNum4 intDECLARE @TotalNum3 intDECLARE @TotalNum2 intDECLARE @TotalNum1 intSELECT SQLStatement = 'SELECT COUNT(*) FROMdbo.Tbl_Réponses_Étudiants WHERE' + @colonne + '=4 AND YY = @year'EXEC sp_executesql @SQLStatement, N'@TotalNum4 int OUTPUT', @TotalNum4OUTPUT INSERT INTO Comptabilisation(Total4) VALUES (@TotalNum4)GO

View 6 Replies View Related

Store The Output In To A Variable

Mar 26, 2008

This is my stored procedure .It is working fine .I want to capture the output in a print statement .Can anyone help me please .




alter proc r (@id INT)

as

BEGIN

DECLARE @input VARCHAR(800)

DECLARE @c_input INT

DECLARE @i_Input INT

DECLARE @input_left VARCHAR(800)

DECLARE @delimiter CHAR(1)

select @delimiter = ','

DECLARE @in VARCHAR(800)

DECLARE @list VARCHAR(800)

declare @list2 VARCHAR(800)



SET @input = 'AWCA,GCS,IHP,Aetna'

select @c_input = (select dbo.Fx_CharCount(@delimiter,@input))

set @c_input = @c_input + 1

while @c_input > 0

BEGIN

select @i_input = charindex(@Delimiter,@input)

if @i_input != 0

BEGIN

select @input_left = left(@input, @i_input - 1)

END

else

select @input_left = @input

select @in = '''' + @input_left + ''''

select @list = ISNULL(@list + ',', '') + @in

select @input = right(@input ,(len(@input) - @i_input))

SET @c_input = @c_input -1

if @c_input = 0 or @input = @input_left

break

end

Print @list

EXECUTE ('SELECT Label FROM repricingsystemtype WHERE Label Not IN (' + @list + ')')

END



View 5 Replies View Related

Redirect The Output To A Variable

Apr 17, 2008


create procedure usp_test (@AccountID INT)asbegin
DECLARE @getAccountID CURSOR
SET @getAccountID = CURSOR FOR
SELECT Account_ID
FROM Accounts
OPEN @getAccountID
FETCH NEXT
FROM @getAccountID INTO @AccountID
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @AccountID
FETCH NEXT
FROM @getAccountID INTO @AccountID
END
CLOSE @getAccountID
DEALLOCATE @getAccountIDend i get nearly ten rows in the print statement how can i assign the output to a out variable where i get all ten rows.

View 5 Replies View Related

Output Table As Variable

May 14, 2007

Hi,



I've been looking into using the ability to select the table of an OLEDB destination task based on a package variable but would like to know if this could be utilised in the following example.



I have a CSV file (potentially there are many) with a number of rows. The rows do not necessarily contain the same number of elements. Each row has an EventID and this is used to determine the database table that the row is to be inserted in.



Initially i thought about using a conditional split to send each row down the path relating to its event ID. There would be multiple destinations depending on the table. With the possibility of 60 to 70 different event ID's this is very quickly going to get out of hand in the designer. I'd like to know if it would be possible to set up a case statement (or similar) in a script component and specify the table name as a variable depending on the event ID. I'd then use this table variable to set the destination task's table property.



Does this sound like a possibility or do i have to go down the route of multiple paths?



Many thanks in advance,



Grant

View 3 Replies View Related

Grab Output Of Dynamic Sql And Use As Variable

May 5, 2008

hello,

I'd like to know how I can grab the output of the following code and use it as variable:

declare @sql nvarchar(25)
set @sql = 'SELECT CURRENT_TIMESTAMP'
EXEC(@sql)

Thank you.

View 2 Replies View Related

Output Filename Downloaded To A Variable

Sep 7, 2007

Hope I can make this clear...

I have to download a file via FTP from one of our vendors, the filename is MMDDYYYY.zip, this is a weekly file and is posted between Tuesday and Thursday, so basically I never know exactly what the file is going to be called, to fix that, I added a FTP Task that will download a file if the date = today (Today = Thursday, when the job kicks off), if this fails, try a file where the name = today-1 (Wednesday), if this fails, try today-2 (Tuesday), all of that inside of a Sequence Container and with MaximumErrorCount set to 3. This is fine and it works fine, good.

Now my other issue, the .txt file inside the zip file (1080.txt), after being decompressed, needs to be renamed to MMDDYYYY.txt, where MMDDYYY = to the file I downloaded, but I never know what the file is going to named (MMDDYYYY, MMDD-1YYYY, MMDD-2YYYY).

Is it possible to output the filename of the file that I successfully download to a variable, so I can re-use name?

Any other thoughts?

View 1 Replies View Related

Stored Procedure With Output Variable

Jul 20, 2005

Can someone post a working stored procedure with output variable thatworks on northwind db or explain to me what I am missing. I've triedever tying but it always returns @outvariable parameter not supplied.I've read everything but must be missing something. Here is an sampleSP that I can't get to work._____________________________________CREATE PROCEDURE SampleProcedure@out smallint OUTPUTASSelect @out = count(*) from titlesGO_____________________________________This errors and returns-Server: Msg 201, Level 16, State 4, Procedure SampleProcedure, Line 0Procedure 'SampleProcedure' expects parameter '@out', which was notsupplied.What am I missing with this?Frustrated,Jeff

View 2 Replies View Related

How Can I Put The Output Of A Stored Procedure Into A Variable

Nov 8, 2007



hi can anyone please help me
i have a stored procedure ,can i put the value of this into a variable......????
I have one more query ---how can i pass the multiple values returned by this stored procedure into a single variable ...
example if my stored procedure is

[dbo].[GetPortfolioName](@NT_Account varchar(100) )
and ans of this are
NL
UK
IN
GN
JK
then how can i put this into a variable like

Declare @PortfolioName as varchar(250)
set @PortfolioName =(exec ].[GetPortfolioName](@NT_Account) )
.......
and my ans is
@PortfolioName = 'NL','UK','IN','GN','JK'

View 22 Replies View Related

Mapping Output Parameter To A Variable!

Apr 25, 2007

Hi there,

I am working on SSIS package that gets data from SQL 2005 Database and writes that to a flat file. But I need to write the count of records as part of the header.

Here is what i am trying:

The OLE DB Source is calling a stored procedure and returning two things i.e. a resultset and an output parameter. The data access mode is SQL Command.



Code SnippetEXEC [Get_logins] ?, ?, ? OUTPUT


In the Set Query Parameters dialogbox, all the three patameters are mapped to three different user variables.

What is happening is that the user variable that is mapped to output parameter is never updated. The header property expression is written as follows




Code SnippetRIGHT("0000000000" + (DT_STR, 10, 1252)@LoginCount, 10)



I tried to watch the variable in watch window but to no avail. Any guidance if it is bug or I am missing some thing? Any thoughts, how can I accomplish this? I have also tried adding Row Count Transformation but its variable has the same behaviour. If I set the value of @LoginCount variable to some value, this initially set value is successfully written to the file header.

Thanks

Paraclete

View 4 Replies View Related

ExecuteSQL Using SQLSource Variable And Output

Nov 16, 2007



Really stuck trying different ways to get a string variable (expression based) to parse and run correctly in an ExecuteSQL task. Would someone be able to advise why one of the following methods works and the other does not?
I'd really prefer to have the second currently not working method be used if possible.

WORKS:
"[audit].[up_LogEtlPackageStart]
@ETLAuditParentKey = ?,
@Description = ?,
@PackageName = ?,
@PackageGuid = ?,
@PackageVersionMajor = ?,
@PackageVersionMinor = ?,
@PackageVersionBuild = ?,
@MachineName = ?,
@ExecutionGuid = ?,
@LogicalDate = ?,
@StartTime = ?,
@Operator = ?,
@ETLAuditKey = ? OUTPUT"

FAILS:
When the variable expression is set as follows I :



Code Block

"[audit].[up_LogEtlPackageStart]
@ETLAuditParentKey = " + (DT_WSTR, 100)@[User::ETLAuditParentKey] + ",
@Description = " + (LEN( @[User::PackageDescription]) == 0 ? "' '" : @[User::PackageDescription]) + ",
@PackageName = " + @[System::PackageName] + ",
@PackageGuid = " + @[System::PackageID] + ",
@PackageVersionMajor = " + (DT_WSTR, 100)@[System::VersionMajor] + ",
@PackageVersionMinor = " + (DT_WSTR, 100)@[System::VersionMinor] + ",
@PackageVersionBuild = " + (DT_WSTR, 100)@[System::VersionBuild] + ",
@MachineName = " + @[System::MachineName] + ",
@ExecutionGuid = " + @[System::ExecutionInstanceGUID] + ",
@LogicalDate = " + (DT_WSTR, 100)@[User::LogicalDate] + ",
@StartTime = " + (DT_WSTR, 100)@[System::StartTime] + ",
@Operator = " + @[System::UserName] + ",
@ETLAuditKey = " + (DT_WSTR, 100)@[User::ETLAuditKey] + " OUTPUT"




This method generates a "Syntax error, permission violation, or other nonspecific error. Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly"

Any ways to get the second failing expression to work?
Is this a problem due to the OUTPUT parameter?
THANKS!

View 7 Replies View Related

Output Of Scheduled Task

Nov 1, 2000

I think I have a basic question. Can someone tell me
the command I can use to have a stored procedure run
and generate output? This is for SQL 6.5.

I would like to schedule the sp_help_revdatabase
stored procedure to run periodically and output it
to a file. I think this is possible, but I haven't
been able to come up with the syntax...

Thanks for any suggestions!
Toni

View 1 Replies View Related

Execute SQL Task W/ XML Output

Apr 19, 2007

I have a stored procedure that returns XML and have defined my own "Root" element w/ "ROOT('urlset')" in the stored procedure. When I put this into my Control Flow, I have a subsequent task that takes this XML stream and writes it to a file. The issue I am running into is that SSIS is adding it's own "Root" element before my output. Is there any way of avoiding this?

View 4 Replies View Related

Using XML Output From UDF In Execute SQL Task

Feb 1, 2007

Hi,

I am trying to do the following without success;

I have a UDF which returns a string of XML data (of the data type XML)

I want to use this UDF within an Execute SQL Task to set a variable to the output of the UDF.  I then want to use the variable to pass the XML string to a XML Task to apply an XSLT to the XML.

I have set the following properties in the Execute SQL Task:

ResultSet: XML

SQLSourceType: Direct Input

SQLStatement: SELECT [dbo].[fn_GENERATE_XML](123) as rawxml

ResultName: 0

Variable Name:user::xml (where the variable is of type string)



My problem is something to do with the UDF call as if I substitute the UDF for a simple SELECT statement with a FOR XML Clause it works fine.

Any ideas where I am going wrong?

Thanks

 

 

View 1 Replies View Related

No Output Variable In Remote Procedure Call?

Sep 10, 2007

I'm calling a procedure on a remote Server (local SQL2005, remote SQL2005) and I need the return value.

Local:
declare @value int execute ('exec mbtest1.dbo.psybcis ?', @value OUTPUT) at [REMOTESQLSERVER] select @value

Remote:
create procedure [dbo].[psybcis] (@value int OUTPUT) as begin select @value = '13' end


I do not get a value in the OUTPUT variable - just NULL. Documentation says:
Execute a pass-through command against a linked server
{ EXEC | EXECUTE } ( { @string_variable | [ N ] 'command_string [ ? ] ' } [ + ...n ] [ { , { value | @variable [ OUTPUT ] } } [ ...n ] ] ) [ AS { LOGIN | USER } = ' name ' ] [ AT linked_server_name ] [;]
There is an OUTPUT parameter, but how does it work? Is my syntax wrong?


It works when using following syntax,
declare @value int exec [REMOTESQLSERVER].mbtest1.dbo.psybcis @value OUTPUT select @value
but I need to use this procedure call in a distributed transaction to a Sybase ASE server and this syntax is not allowed for cross-system-calls.
So first I want to get it work from SQL2005 to SQL2005.

View 2 Replies View Related

Stored Proc Output Parameter To A Variable

Mar 16, 2006

I'm trying to call a stored procedure in an Execute SQL task which has several parameters. Four of the parameters are input from package variables. A fifth parameter is an output parameter and its result needs to be saved to a package variable.

Here is the entirety of the SQL in the SQLStatement property:
EXEC log_ItemAdd @Destination = 'isMedicalClaim', @ImportJobId = ?, @Started = NULL, @Status = 1, @FileType = ?, @FileName = ?, @FilePath = ?, @Description = NULL, @ItemId = ? OUTPUT;
I have also tried it like this:
EXEC log_ItemAdd 'isMedicalClaim', ?, NULL, 1, ?, ?, ?, NULL, ? OUTPUT;

Here are my Parameter Mappings:
Variable Name Direction Data Type Parameter Name
User::ImportJobId Input LONG 0
User::FileType Input LONG 1
User::FileName Input LONG 2
User::FilePath Input LONG 3
User::ImportId Output LONG 4

When this task is run, I get the following error:


0xC002F210 at [Task Name], Execute SQL Task: Executing the query "EXEC log_ItemAdd @Destination = 'isMedicalClaim', @ImportJobId = ?, @Started = NULL, @Status = 1, @FileType = ?, @FileName = ?, @FilePath = ?, @Description = NULL, @ItemId = ? OUTPUT" failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_I4)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
The User::ImportId package variable is scoped to the package and I've given it data types from Byte through Int64. It always fails with the same error. I've also tried adjusting the Data Type on the Parameter Mapping, but nothing seems to work.
Any thoughts on what I might be doing wrong?
Thanks.

View 4 Replies View Related

Assign An Output Of Derive Column To Variable

Sep 11, 2007

I have a derive column( sequence) transformation in data flow , i am trying to assign this column to a variable , so that i can use it in the SQLtask control flow... how can i do this? can you show me some examples?

View 10 Replies View Related

Help On Script Component Assignment Of Output Variable

Sep 7, 2005

Hi all,

View 9 Replies View Related

How Can You Use A Variable Tablename And Retrieve The Output From The Insert?

Aug 28, 2007

We are trying to create a unique key from a table with indentity set in the table. We will have a number of these tables. Therefore, we will be creating a stored procedure and passing the table as a parameter. In this example we are setting the table.

When we run the the script, the output clause from the insert should give us a unique number from the given table in the temporary table. This example stores the output in a temporary table @tTemp.

How can you use a variable table name and retrieve the output from the Insert?


declare @tTestTable varchar (20)

set @tTestTable = 'mis.test_sequence'


--DECLARE @tTestTable TABLE ( sqVal [int] IDENTITY(1,1) NOT NULL, add_date datetime)
declare @testsql varchar (4000), @testseq int

DECLARE @tTemp table (mainpk int)

set @testsql = 'DECLARE @tTemp table (mainpk int) INSERT ' + @tTestTable + ' OUTPUT INSERTED.sqVal into @tTemp VALUES (getdate() ) SELECT @testseq=mainpk FROM @tTemp'

select @testsql

EXECUTE sp_executesql @testsql, N'@testseq int output,@tTemp table (mainpk int),@tTemp table (mainpk int) ',@tTemp,@tTemp,@testseq output,@tTemp

SELECT * FROM @tTemp



Please help
Thanks Tim.

View 3 Replies View Related

Excel Task Has No Output Columns

Oct 20, 2006

I created an Excel Source and used a query to get the data,i.e

SELECT F1,F2,F3,F4,F5,F6,F7 FROM [Fut Days$A20:G1480]

The query works fine, the preview returns the rows, but SSIS will not generate output Columns nor will it let me manually add them? Am I missing something?

View 3 Replies View Related

Message Output From XSLT XML Task

Sep 11, 2006

Where does output from <xsl:message> stylesheet elements go? It's not in the Progress or Output window, and there doesn't seem to be a property that controls the destination for messages.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved