DtExec: Setting User-defined Properties With Whitespace?

May 2, 2007

Hi there.



I'd like to call dtexec with something like this:



dtexec /f myPackage.dtsx /Set package.variables[User::connStr].Value;Source=localhost;Provider=blah;Integrated Security=SSPI;



I get an error along the lines of

Option "Source=localhost;Provider=blah;Integrated" is not valid".



How do I pass in a property containing spaces? I've tried all of the usual quote-encasing patterns I can think of.



Thanks,



Jon

View 5 Replies


ADVERTISEMENT

Setting Package Variable Using Dtexec

Feb 15, 2008

Hi,

If this is the syntax to set a property in a package using dtexec:

/set PackageMyForEachLoopMyDataFlow.Disable;False

What is the syntax for setting a global variable in the package?

Thanks

View 1 Replies View Related

Problem Setting Gvar With DTEXEC

Jun 19, 2006

I am attempting to execute a pckg using DTEXEC.  I need to set a package
variable to the text value "SQLAgent".  This variable, 'Caller', is scoped
for the package itself.  This is the command stmt:

dtexec /DTS "MSDBPATHPCKGNAME" /SERVER SERVERNAME  /SET
Package.Variables[User::Caller].Properties[Value];SQLAgent


I am receiving the following message when I execute this from cmdshell. 
What am I doing wrong when trying to set the variable??

Message
Executed as user: SERVERNAMESYSTEM. Microsoft (R) SQL Server Execute
Package Utility  Version 9.00.1399.06 for 32-bit  Copyright (C) Microsoft
Corp 1984-2005. All rights reserved.    Started:  12:53:54 PM  Warning:
2006-06-16 12:53:55.04    Code: 0x80012017    Source: PCKGNAME     
Description: The package path referenced an object that cannot be found:
"Package.Variables[User::Caller].Properties[Value]". This occurs when an
attempt is made to resolve a package path to an object that cannot be found. 
End Warning  DTExec: Could not set
Package.Variables[User::Caller].Properties[Value] value to SQLAgent. 
Started:  12:53:54 PM  Finished: 12:53:55 PM  Elapsed:  0.125 seconds. 
Process Exit Code 1.  The step failed.

Thanks.

View 1 Replies View Related

Problem While Setting Global Params Using DTEXec Utiltiy

Jul 31, 2007






Hi pals,

I am new to SSIS.I am getting a problem while setting the global parameters.
I created a package with a single task i.e an Execute SQL task.The associated sql is
"delete from src_emp where deptno=?" and i added a new user defined variable as "dno" i.e "user:no"
which of String type with scope=<package name>.The name of my package is "test.dtsx" which is a Structured File
save in my d: directory. I harded code the value in SSIS package desiner i.e in BIDS and tested the functionality,
it is working fine. But when i remove the hard coded value and when i tried to call the dts package using the command line
utility DTExec, i am getting. Below are the different ways i tried to set the global parameters.



trial 1:
---------

D:>dtexec /f test.dtsx /SET "Package.Variables[User:no].Properties[value]";"20"
Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Started: 11:06:51 AM
Warning: 2007-07-31 11:06:53.00
Code: 0x80012017
Source: Aug
Description: The package path referenced an object that cannot be found: "Package.Variables[User:no].Properties[value]".
This occurs when an attempt is made to resolve a package path to an object that cannot be found.
End Warning
DTExec: Could not set Package.Variables[User:no].Properties[value] value to 20.
Started: 11:06:51 AM
Finished: 11:06:53 AM
Elapsed: 1.094 seconds

trial 2:
---------

D:>dtexec /f test.dtsx /SET "Package.Variables[User:no].value";"20"
Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Started: 11:08:04 AM
Warning: 2007-07-31 11:08:05.99
Code: 0x80012017
Source: Aug
Description: The package path referenced an object that cannot be found: "Package.Variables[User:no].value". This occurs
when an attempt is made to resolve a package path to an object that cannot be found.
End Warning
DTExec: Could not set Package.Variables[User:no].value value to 20.
Started: 11:08:04 AM
Finished: 11:08:05 AM
Elapsed: 1.078 seconds

trial 3:
---------
D:>dtexec /f test.dtsx /SET "PackageExecute SQLTask.Variables[User:no].value";"20"
Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Started: 11:09:56 AM
Warning: 2007-07-31 11:09:57.58
Code: 0x80012017
Source: Aug
Description: The package path referenced an object that cannot be found: "PackageExecute SQLTask.Variables[User:no].val
ue". This occurs when an attempt is made to resolve a package path to an object that cannot be found.
End Warning
DTExec: Could not set PackageExecute SQLTask.Variables[User:no].value value to 20.
Started: 11:09:56 AM
Finished: 11:09:57 AM
Elapsed: 1.062 seconds


Any suggestions would be appreciated.
Thanks and Regards,
Manu

View 1 Replies View Related

SQL 2012 :: How To Obtain Some Properties Of Circle Defined As A Geometry Data Type

Jul 15, 2014

I am not very familiar with working with spatial data and I am currently trying to work out how to obtain some properties of a circle defined as a geometry data type. Specifically, I need to determine x and y co-ordinates for the centre point and the diameter of the circle.I have had a look at the MSDN reference for spatial data .

View 4 Replies View Related

User-defined Fun Or The System-defined Fun

Apr 2, 2008

hai,

how can i identify the function is user defined or the system defined function....................

View 1 Replies View Related

Setting The OLEDB Connection Properties At Runtime

Jan 30, 2007

I used to do this in DTS but wondered how to do it in SSIS. I have a For Each ADO recordset loop that reads these four columns into variables:

DataSource Name, Name(for a WHERE clause), user and password.

For each "Building" there is a new server to connect to, with identical tables. I have 10 tables in the loop to pump from one database to a SQL 2005 database (i.e. 10 dataflows). I want to set the source connection information with the variables. My questions:

1. How do I set the connection information for the source connections? Do I just set the properties for the connection manager and then it sets for all the sources? What property do I set--do I need a script task?

2. How do I use the values from the "Name" column in a WHERE clause in each data flow?

Thanks!

Kayda

View 4 Replies View Related

Setting Up Default Report Startup Properties

Apr 13, 2007

Hello,

Is it possible to establish a set of default report and report body properties, perhaps in an ini file of some sort so that upon creating a new project and adding a new report item the developer does not have to go through the process of setting up all the interactive sizes, margins, paper sizes, etc each and every time? We have an established header that we incorporate on all reports and while in transition to the new Reporting Services it was my hope of finding something will create the first set of default conditions to help us automate the process just a bit.



Thank you.

View 2 Replies View Related

Problem Setting Package Properties From Dtexecui

May 17, 2007

I want to input a parameter to my package. I have a variable, and I tried changing its value from DTExecUI.

I did everything as mentioned in http://blogs.conchango.com/jamiethomson/archive/2007/03/13/SSIS_3A00_-Property-Paths-syntax.aspx but I still get an error -

Could not set "Package.Variables[User::var_input_step_Name].Properties[Value]" value to "RAW".



The variable was originally read from a XML config file. I stored the package to MSDB. I then ran dtexecui, selected my msdb package, and in Set Values, I entered property path and value. I also tried removing the "", and I even deleted the XML configuration. Still the same error.

What am I doing wrong? Any Package Settings to make?

TIA

Kar

View 4 Replies View Related

Login Failed: Reason: User &#39;_&#39; Not Defined As A Valid User Of Trusted

Jan 26, 2000

Our server has integrated security setup, upon startup of the server,
we have a continuous flow of error msg:
Login Failed: Reason: User '_' not defined as a valid user of trusted
connection.
The timing of these messages only around 30 seconds apart
The only incident from Technet I can find is Q186314, but we don't have replication setup, anyone knows where I can look into ?
I recycle the server but didn't help.
I appreciate any help I can get ..
Thanks.

View 1 Replies View Related

Login Failed- User: Reason: Not Defined As A Valid User Of A Trusted SQL Server Connection.

Apr 5, 1999

Hi,

i'm a newbie in SQL. I can't connect to SQL 6.5 server using ASP ADO. Below is the program code

<%
set conn=server.createobject("adodb.connection")
conn.open "dsn=Central;uid=sa;pwd="
%>

An error message appears
Login failed- User: Reason: Not defined as a valid user of a trusted SQL Server connection.

I've already created a ODBC System DSN named Central
parameter Server Local and used Trusted connection checked.

Then under sql Manager there is a sa with a blank password.

Please help.

View 1 Replies View Related

Adding Foreach Container Programmatically And Setting The Enumerator Properties

Jul 10, 2007

Hi

I have a package which contains a foreach container. Can anyone help me in setting the properties for the enumerators programmatically??? I am trying to set the properties for the enumerator "ForEach File Enumerator"

The properties which i need to set are

1. Folder

2. File Type

3. Traverse Subfolder

4. Retrieve File Name



Thanks in Advance

Suganya

View 1 Replies View Related

Problm Setting Up User. Error: User Is Null

Jul 20, 2005

On MS-SQL 2k I have a created user. Security for the SQL instance isset to mixed.When I attempt to connect to SQL using Enterprise client on anothermachine on the local network using Windows Auth I get the error: DBName-Login Failed for user ('null')- Reason: Not associated with atrusted SQL Server Connection.What am I over looking?TIA

View 1 Replies View Related

Problem: SSIS Package Failure Using 32-bit DTExec And 64-bit DTExec

Apr 17, 2008

Hi all,


I have a serious problem with my SSIS Package while executing using 32-bit DTExec and 64-bit DTExec.


Here are the details:

Environment:

Windows Server 2003 64-bit (Build 3790: Service Pack 2)
SSIS 32-bit & 64-bit installed
SQL Server 2005 (Microsoft SQL Server 2005 - 9.00.1399.06 (X64) - RTM)

SSIS Package details (compiled in 64 bit)

Script tasks only
Microsoft Visual Basic .NET (using TRY...CATCH block)
PreCompileScriptIntoBinaryCode = TRUE
Run64BitRunTime = TRUE

Execution

Batch file that uses DTExec to execute the Package.

SCENARIO
I am trying to exeucte the above SSIS package using both 32-bit and 64-bit DTExec to make it failure by providing invalid connection string. Here are the details,


Wrong connection String using 32-bit Execution

While establishing the connection the error message has been nicely captured in to my Exception block and writes into the log file.

Wrong connection String using 64-bit Execution

While establishing the connection the error has not been catpured anywhere (although I have TRY CATCH block) and it haults there itself with the message "Process is terminated due to StackOverflowException". Later I found that the error is due to the connection string along with the unhandled exception.

Please suggest any one of the following my findings, also if you have any other advice would be very much appreciated.

1. Shall I go ahead and fix the issue by handling those unhandled errors? (e.g Appdomain, application). I tried several but still not working using 64-bit DTExec.

2. Shall I go ahead and use 32-bit DTExec to execute the package? If so, is there any other major issue...like performance or anyother bug?


P.S: We cannot apply any service pack for SQL Server 2005 at the moment. Sorry abt it. If you have any specific hotfix for DTExec (without affecting SQL Server) then we can decide.

Sorry for the lengthy one and Thanks very much for you help in advance .



Thanks again!

Suresh






View 13 Replies View Related

Help With User Defined Function

Jan 10, 2007

I have a UDF that takes my input and returns the next valid business day date. My valid date excludes weekends and holidays.
It works perfect except for one issue. It doesn't check to see if today's date  is a holiday.
I pass a query to sql server like so " select dbo.getstartdate('01/ 10/2007',2)"
It then moves ahead two business days and returns that date.
Here is the current code. Hopefully someone can tell me how to do the holiday check on the current date.
I really don't want to rewrite the whole script .
Code---------------------------------------------------------
SET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS OFF GO
--DROP FUNCTION GetStartDate
--declare function receiving two parameters ---the date we start counting and the number of business days
CREATE  FUNCTION GetStartDate (@startdate datetime, @days int)   RETURNS datetimeASBEGIN
--declare a counter to keep track of how many days are passingdeclare @counter int
/*Check your business rules.  If 4 business days means you count starting tomorrow, set counter to 0.  If you start counting today, set counter to 1*/set @counter = 1
--declare a variable to hold the ending datedeclare @enddate datetime
--set the end date to the start date.  we'll be -- incrementing it for each passing business dayset @enddate = @startdate
/*Start your loop.While your counter (which was set to 1), is less than or equal to the number of business days increment your end date*/WHILE @counter <= @days
BEGIN
--for each day, we'll add one to the end dateset @enddate = DATEADD(dd, 1, @enddate)
   --If the day is between 2 and 6 (meaning it's a week   --day and the day is not in the holiday table, we'll    --increment the counter   IF (DATEPART(dw, @enddate) between 2 and 6) AND       (@enddate not in           (           select HolidayDate            from tFederalHoliday            where [HolidayYear] = datepart(yyyy,@enddate)         )       )   BEGIN      set @counter = @counter + 1   END
--end the while loopEND
--return the end dateRETURN @enddate
--end the functionEND
GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO
---------------------------------------------------------------------------------------------

View 1 Replies View Related

SQL User Defined View

Aug 22, 2007

I've a view in which one of the fields were  DATEDIFF(day,contract date,received) AS AgeOfAccount. I changed it to DATEDIFF(day, m.received, CASE WHEN m.clidlp > m.clidlc THEN m.clidlp ELSE m.clidlc END) * - 1 AS AgeOfAccount. When I execute the view  I'm getting an error. But the results are getting displayed properly. That's what's puzzling me. Could someone tell me what the error is.
 
The following errors were encountered while parsing the contents of the sql pane. 
Your entry cannot be converted to a valid date time value.

View 4 Replies View Related

User-defined Functions - Help!

Sep 3, 2004

Hi,

I have a search returning many 'car' records (regno, mileage, color, etc)

In a seperate table I have two columns: accessory and regno. This can have many rows for each regnumber.

Within the storedprocedure that returns the 'car' records I need to also return the relevant accessories for that car as one column.

I have written a function as such (with some help!):

ALTER Function getAccs(@regNo varChar(20))
RETURNS varChar
AS
BEGIN
Declare @List varchar(1000)
SELECT @List = COALESCE(@List + ', ', '') + accessory
FROM frxrep2.dbo.usedaccessories WHERE regnumber = @regno
return @List
END

I was hoping that I could simply use this in the 'car' SELECT statement.

ie:

SELECT regNo, color, mileage, dob.getAccs(regno) as AccessoryList
FROM tableBla etc


I'm not even sure if the function works - How can I test in SQL analyzer?

any help much appreciated,

Pete

View 3 Replies View Related

User Defined Function

Aug 17, 2005

Hi everyone,
    I am tring to pass acomma delimited string to a function  and this function is parsing the string so that I can see individual values so for example I am passing 1,2,3,4,5 as a parameter to my function and I am parsing this string so that I can write something like this
Select * from tableA where userID in(1,2,3,4)
It is working fine. Only problem is if the user passes word 'all' instead of 1,2,3,4 then I have to doSelect * from tableA
My function looks like this.  How can I modify this function if I pass 'all' as a paramater. Any help will be appreciated.CREATE FUNCTION [dbo].[ParseText2File] (@p_text varchar(4000), @p_Delimeter char(1))
RETURNS @results TABLE (id varchar(100))
AS
BEGIN
declare @i1 varchar(200)
declare @i2 varchar(200)
declare @tempResults Table (id varchar(100))
while len(@p_text) > 0 and charindex
(@p_Delimeter, @p_text) <> 0
begin
select @i1 = left(@p_text, charindex(@p_Delimeter, @p_text) - 1)
insert @tempResults select @i1
select @p_text = right(@p_text, len(@p_text) - charindex(@p_Delimeter,@p_text))
end
insert @tempResults select @p_text
insert @results
select *
from @tempResults
return
END
Thanks

View 1 Replies View Related

User Defined Functions In SQL 7.0

Oct 11, 2000

Hi,

I know that we cannot have User Defined Functions in SQL 7.0, but is there a work around. I am trying to standardize the date according to the time zone using a function and use it as part of a select statement.

I cannot believe that is not possible in SQL 7.0, can somebody tell me what is the work around, I am running against time. I really appreciate any help on this one.

Satish.

View 1 Replies View Related

User Defined SQL Function

Dec 14, 1999

How can I create a user defined function in SQL and call it inline from a SQL statement? I need the ability to execute a statement such as:

select myFunc(x,y) from table

I need myFunc(x,y) to return a value, not a recordset and use that value in the select statement. Any and all ideas would be appreciated.

View 1 Replies View Related

User Defined Function

Aug 2, 1999

Dear friends,

I am a new user for SQL server. Coming from an oracle background, I find it very difficult to live without user defined functions. At the moment, I urgently need to have a function returning an custom-made ID string, so that it can be used in one of my stored procedures. I have heard the rumours that SQL server 7 does NOT support user defined functions, (which SQL 6.5 does). I would be really grateful if anyone can clarify this for me, and if possible, suggest a get-around approach.

Thanks in advance!

Kai

View 2 Replies View Related

Help Pls!! &#39;Not Defined As Valid User&#34;

Dec 16, 1999

all schedulled task on server failed for 18450 Process Exit Code 1. ...t Utility, Version 6.50.240 Copyright (C) Microsoft Corporation, 1995 - 1996 [Microsoft SQL-DMO] Error 18450: [SQL Server] Login failed- User: sqlexec Reason: Not defined as a valid user of a trusted SQL Server connection.
Any information on how to solve it

View 1 Replies View Related

User Defined Datatypes

Jan 5, 1999

Is it possible to change the owner of a User Defined Dataype? I've
recently had to change the owner of one of my databases and the
tables from a specific user to 'dbo'. The UDD's are the only objects
I am unable to change the ownership of.

Any suggestions anyone?
Thanks for any advice!
Toni Eibner

View 1 Replies View Related

User Defined Function Help!

Jun 23, 2004

I am trying to compare the data from one table (shipments) with the data from a view. The point of the function is to match the correct territory with the account depending on the data. Basically, I this deals with accounts that are transfering from one territory to another. The transfers take effect on the first day of the month, retroactive, therefore we need to allocate the sales data to the correct territory in the shipments table. Here is my function. Can someone tell me how I can get this to work and insert a territory ID for the account that has transfered into the shipments table?

CREATE FUNCTION fnShipments ()
RETURNS @Shipments TABLE (AccountID CHAR(10), DateInvoice DateTime, DollarShipments Money, TerritoryID CHAR(10))
AS
BEGIN
INSERT @Shipments (AccountID, DateInvoice, DollarShipments, TerritoryID)
SELECT Shipments.AccountID, Shipments.DateInvoice, DollarShipments, ISNULL((SELECT TerritoryID FROM vwAccountTransfers

WHERE Shipments.AccountID = vwAccountTransfers.AccountID

AND vwAccountTransfers.EffectiveMonth =

(SELECT MIN(EffectiveMonth)
FROM vwAccountTransfers

WHERE Shipments.AccountID = vwAccountTransfers.AccountID
AND DatePart(m,Shipments.DateInvoice) < vwAccountTransfers.EffectiveMonth)),
(SELECT TerritoryID FROM vwAccountTransfers
WHERE Shipments.AccountID = vwAccountTransfers.AccountID
AND vwAccountTransfers.EffectiveMonth Is Null )
) AS Territory
FROM Shipments

ORDER BY Shipments.AccountID, Shipments.DateInvoice;
RETURN
END

View 1 Replies View Related

User Defined Function

Nov 10, 2004

I need a UDF that will do the following:

User: Will be sending me a datetime e.g '9 Nov 2004 15:00:00'
I want the UDF to do the following for me
Return in hours the difference between what the user has send and now (lets say now = '10 Nov 2004 11:00:00')
So the UDF will return to me 20.
But I dont want 20, I want the UDF to avoid any all hours which are not work related (any time after 16h00
until 8h00 in the morning), so I want this UDF to return 4. That means from '9 Nov 2004 15:00:00' I have calculated
1hr until 16h00 and 3hrs from 8 until 11h00 on '10 Nov 2004 11:00:00'

AGAIN IT MUST NOT CALCULATE WEEKENDS. Lets say '12 Nov 2004 15:00:00' was Friday and now = '15 Nov 2004 11:00:00', I must still
get 4 as a return from UDF

I would also like now to be my getdate(), but it seems like you can't use it in UDF

View 1 Replies View Related

User Defined Functions And OLE

Aug 18, 2006

Hi everyone

I am implementing an encrypted data system whereby captured data is encrypted using MS CAPICOM when written to DB and decrypted when displayed. It works well. However, each time you write the data back on update the encryption is different from the previous time.

I have a search screen that allows users to enter text data and submit it looking for matches. Of course, the user is entering unencrypted text and the DB data is encrypted.

This means that you can't encrypt the input data before you try to match because the encryption alogorithm used on the input data will not match that which was used to encrypt the DB data.

Are you with me so far?

So, you have to compare the uncencrypted input data with DECRYPTED DB data - in other words, decrypt the DB data on the fly within the where clause of your query.

I have accomplished this by writing a UDF that instantiates an instance of the CAPICOM encryption module and calling the UDF when applying the query
eg where udf(columnname1) = 'inputtext' or udf(columnname1) = 'inputtext'.

It works, I get the results that I want.

But, alas, the performance has taken a search severe hit.

Has anyone else ventured down this road?

Is there a better way of doing this?

Thanks

Ray

View 12 Replies View Related

User Defined Variables

Jan 5, 2007

I am running a procedure that declares a table with a user defined variable called ZipCodes8000. This datatype is on the systypes table as a valid datatype that we created. Here is the code and the error that is returned. Can anyone help me understand why I receive the error that I do.

Code:

DECLARE @SortPlanBinZipCodeRanges TABLE
(
SortPlanBinZipCodeRangeIDINT IDENTITY (1, 1) NOT NULL,
SortPlanBinID INT NULL,
SortPlanID INT NULL,
BinTypeID TINYINT NULL,
BinFlagTypeID TINYINT NULL,
BinNumber INT NULL,
ZipCodeRanges ZipCodes8000 NULL
)


error:
Msg 2715, Level 16, State 7, Line 1
Column or parameter #7: Cannot find data type ZipCodes8000.

Thank you in advance.

Todd

View 8 Replies View Related

User Defined Types

Jan 16, 2008

I've been doing some reading on UDT's and have a question...

It was suggested in one of the pieces I read that you could create a UDT for, in their example, cities. And every table that had a reference to city could share this datatype. Now, my initial thought was "wow, what a great idea! I wouldn't have to remember the exact datatype for my primary keys (was it a char(5) or char(6)?) and have a "central depository" for my key datatypes.

So the first question is; what are the disadvantages of such a design?

And the second is; How do you update a UDT? If business requirements change and udt_city needs to be changed from varchar(30) to varchar(60), for example, what would be the way of echoing the change thoughout your database?

My gut reaction for the answers are
1) performance will decrease as effectively the dbms has to "parse" every insert/update to a UDT field in a different method.

2) create a new udt and alter any tables referencing the old one before dropping it.

What do we think?

View 14 Replies View Related

User Defined Variable

Mar 18, 2008

Hello

Is there a way that I can create a user defined variable in my database? I have a fairly large chunk of xml that I would like to store in the database that can be updated by clients ( in rare cases ). I could use other mechinisms to allow access to it, but all other application related information is stored nicely in this one place, I hate to vary for this single piece.

Thank you for your time and thoughts.
Patrick

View 14 Replies View Related

User Defined Functions

Jan 27, 2004

hi all,

I made myself a user defined function, it works great, but is there a way to make it available to all databases?

cheers,

alex

View 14 Replies View Related

User Defined Functions

Feb 19, 2004

When I define a UDF in SQL 2000 I can't execute it without qualifiction. Here's the code:
CREATE FUNCTION GetLastShipDate(@DO_No CHAR(10))
RETURNS CHAR(10)
-- DROP FUNCTION GetLastShipDate
BEGIN
DECLARE @v_last_ship_date CHAR(10)

SELECT @v_last_ship_date = COALESCE(CONVERT(CHAR(10), MAX(Asn.Asn_Ship_DateTime), 110), '')
FROM Asn,Asn_Do
WHERE Asn_Do.Asn_Number=Asn.Asn_Number
AND Asn_Do.DO_Number = @DO_No
AND Asn.ASN_STATUS in ('SENT','RESENT')


RETURN @v_last_ship_date
END

So I have to execute this with:

SELECT dbo.GetLastShipDate('T010215004')

I want to execute it with

SELECT GetLastShipDate('T010215004')

What am I doing wrong?

View 7 Replies View Related

User Defined Function Help?

Mar 20, 2004

I create the following UDF just for learning purposes and I cannot seem to get it to return a value.

Stored Procedure

REATE PROCEDURE usp_GetXSection

@fWidth float,
@fHeight float,
@fResult float OUTPUT

AS
BEGIN
set @fResult = [dbo].[XSECTION](@fWidth, @fHeight)
END
GO


Ane the following UDF


CREATE FUNCTION XSECTION
(@Width float, @Height float)
RETURNS float
AS
BEGIN
RETURN (@Width * @Height)
END


I call it using ADO in a c++ application, but all returns empty

Any ideas? C++ code to follow.

Mike B


void CFormTemplateSetup::OnCalculate()
{
_CommandPtr pCmd(__uuidof(Command));
_ParameterPtr pWidth(__uuidof(Parameter));
_ParameterPtr pHeight(__uuidof(Parameter));
_ParameterPtr pResult(__uuidof(Parameter));

try
{
pCmd->ActiveConnection = GetDocument()->GetConnection();
pCmd->CommandText = _T("usp_GetXSection");
pCmd->CommandType = adCmdStoredProc;

_variant_t vWidth, vHeight;
vWidth.vt = VT_R4;
vHeight.vt = VT_R4;

vWidth.fltVal = 10;
vHeight.fltVal = 10;

pWidth = pCmd->CreateParameter(_T("@fWidth"), adInteger, adParamInput, sizeof(int), vWidth);
pHeight = pCmd->CreateParameter(_T("@fHeight"), adInteger, adParamInput, sizeof(int), vHeight);
pResult = pCmd->CreateParameter(_T("@fResult"), adDouble, adParamOutput, sizeof(float), vtMissing);

pCmd->Parameters->Append(pWidth);
pCmd->Parameters->Append(pHeight);
pCmd->Parameters->Append(pResult);

_variant_t vResult = pResult->Value;

float fArea = pResult->Value.fltVal;
CString csArea;
csArea.Format("Area = %d", fArea);

::AfxMessageBox(csArea);
}
catch(_com_error& e)
{
::AfxMessageBox(e.Description());
}
}

View 1 Replies View Related

User-defined Types

Sep 8, 2005

Iam trying to create a geo-database.
For that i need to have a spatial data type called polygon which takes in values as int. so it can be declared as:
POLYGON(0 0, 100 0, 100 100, 0 100, 0 0)

How do i do that.
plz help.

---
Iam not real any more
Iam just an Illusion
---

View 20 Replies View Related







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