DTS Package - Need Help W/ Parameter Query

Oct 5, 2005

I am trying to get a DTS package to work w/ an ActiveX box to prompt user for a Date. I am pulling data out of a table into an Excel spreadsheet. The date keyed by user gets passed into parameter ? in query. I have assigned a global variable to package also. The DTS package executes fine but no row appear in the Excel spreadsheet. I'm guessing that the date keyed in input box does not match date from database for some reason. I have tried multiple ways of inputing date in input box and have tried different case/convert statements in query. I know the dates are there because I can hard code in the date as '2005-10-03' and it works. Just can't get it work by feeding in user input into where clause. Does anyone know what I'm missing.

I have a much more complex query but here's the simple one I'm using just to try to get it to work.


select consumerid,
convert(char(10),servicedatefrom, 101) 'Date of Service',
convert(char(10),updatedate, 101) 'Update Date'
from tbl_cs_sv_service
where convert(char(10),updatedate, 101) = ?


Here's the ActiveX script to prompt user for date input

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()

dim tamdate
tamdate = inputbox ("Enter Date")
msgbox ("You entered: " & tamdate)

Main = DTSStepScriptResult_ExecuteTask

End Function


Any advice would be wonderful as I'm pulling my hair out at this point.

Thanks much......wisa64

View 1 Replies


ADVERTISEMENT

Passing The Xml Configuration File To The Package As An Input Parameter While Executing The Package

Feb 2, 2007

Hi,

I am planning to develop a single package that will download files from ftp server, move the files to internal file server and upload it in the database. But I want to run this package for multiple ftp file providers. For each provider the ftp server might be different and the transformation to upload the files into a database table might be different.

So can I create a single package and then multiple configuration files (xml), which will contain the details fo the ftp file providers and then pass the xml file as a parameter while executing the package. The reason being that the timings of fetching the files is different for each ftp file provider and hence cannot be combined into one.

Is this possible?

Thanks for your help.

$wapnil

View 6 Replies View Related

Example Of Parameter In DTS Package

Mar 6, 2007

Hi,
     Please show me a example of how to create and use a Parameter in DTS Package (SQL Server 2000)
Thanks,
Vivek Gupta 
 

View 2 Replies View Related

Parameter Is Missing In A Dts Package

Jun 26, 2001

Here is the problem.

SQL server 7.0 running Service Pack 2.0 has some DTS packages on it. A user puts service pack 3.0 on his workstation. Now we cannot open the package.
We are getting the Parameter is missing errror message. I remember somewhere you go and change a binary setting. Does anyone know how we can fix this?

Thanks,
Dianne

View 3 Replies View Related

How Could I Pass A Parameter To DTS Package?

Mar 2, 2006

I build a DTS package to get data from Oracle.
The data I want may be yesterday, may be two days ago or may be others. So I need a date parameter to tell the package how to get the data. But I do not know how to do it.

View 1 Replies View Related

How To Pass Parameter To DTS Package

Mar 27, 2008

I am new to the SSIS.

For DTS package of sql server 2000, I can call a DTS package from stored procedure. The command is:

dtsrun /E /SMyServer /NMyDTS /Wtrue /A Parameter1:3= 'Test'

Does anyone know, how do I do the similar thing from SSIS environment.

1) How to call a SSIS package from Stored Procedure?
2) How do I pass parameter to the SSIS package?

Thanks everyone.

View 1 Replies View Related

Parameter Error When Opening Package

Aug 28, 2000

I am getting an error stating the parameter is incorrect when I open a package on my laptap. If I do it on the server it works fine. I even tried recreating my ODBC connection on my laptop thinking that might be it. Any suggestions would be appreciated.

View 2 Replies View Related

Passing A Boolean Parameter To A Package

Jan 17, 2007

hello at everybody well i have a problem. with in a package i defined a bollean variable with the name "x" and with a default value FALSE.



i created a configuaration file that contains the variable "x" as [user::x]. when i deploy the package to a server and i try to execute the package putting to the set values TRUE fror the x variable it doesnt work.

what can i do??

thnxs

View 1 Replies View Related

Passing Parameter To Package From Scheduler

Feb 12, 2007

I need to have scheduler passing the latest datetime to my Package at the time it kicks it off.
Also, How would I receive the argument in my package ? I mean, in some variable or there are some other construct in SSIS.

Any help in this will sincerely be appreciated.


Fahad

View 1 Replies View Related

How To Give Parameter Value At Runtime In SSIS Package

Aug 31, 2006

Hi



i am develope package using Oracle DataBase



My Logic is INSERT NEw Reocrds And Updated Existing Records With Some Condiotion .



In Source query Some select Columns with Where Condiotion .This Where Condition Field value should pass at that time of Runtime Parameter. How to Achieve Parameter value pass in OLEDB Source at run time.



Please any one give me the Solution. I am struggling with INSERT , UPDATE Records With Paramet condiotion,? Any one give Sample Insert and Update with Parameter using Oracle Database?







Thanks & regards,

Jeyakumar .M



View 1 Replies View Related

How To Call A SSIS Package With A Specific Parameter

Apr 2, 2008

I need to be able to call a SSIS package with a specific parameter for one of the variables. Basically the package needs to be triggered from an application (.NET, C#) with a specific value.

The package is stored in the SQL Server (in Stored packages).

I have seen the article on dtexec and the SET flag, however we do not want to turn on xp_cmdshell on the SQL server due to the security implications, and that seems to be the only way to call dtexec

I have seen another article that says you can have a job invoke a package then have a specific user granted permission to the job, but that doesn't address how to set the parameter/variable for the package.

There are actually some other steps that technically need to run using the same parameter, so ideally if I could have a stored procedure call the SSIS package, then the subsequent toher stored procedures using the sent in parameter that would be great. I just can't figure out how to do this securely (as xp_cmdshell is not considered secure).

Thanks for any comments.

View 12 Replies View Related

Pass Parameter To IS Package Through SQL Agent Scheduler

Mar 1, 2007

Hi,
I have to schedule jobs through SQL Agent, I know how to do it in command line. But I am wondering if there is a way to do it in Scheduler.

Also, I need to know the way to do it through SMO.



Thanks,
Fahad

View 4 Replies View Related

How-to Execute SSIS Package With Input Parameter?

May 19, 2006

Hi all.

we have SSIS package which runs under SQL Job.

Now we need to modify this package in order to have input parameter

which we want to setup in the "Set Value" Tab of SQL Server 2005 SQL Job |Edit Step |Option window.

Could anybody give me in details how-to setup Global Variable (or something else) inside SSIS Package in order to create input parameter of the package?

I also appreciate an advice how exactly we should assign value to input parameter of SSIS Package inside SQL Job Set Value Tab (example?).

Thank you,

Vitaliy

View 3 Replies View Related

How Do I Pass A Parameter From A SSRS Report To The Sql Stmt In A SSIS Package

Aug 24, 2007

How do I pass a parameter from a SSRS report to the sql stmt in a SSIS package?
Mainly need to know the correct syntax of the connection string to use for the datasource in the SSRS report. Every time I add the /SET part of the string the connection breaks.
The connection string i've been using is:
/file "C:\PackageName.dtsx /Set Package.Variables[StartDate];"&Parameters!StartDate.Value

View 26 Replies View Related

Passing SSIS Package Variable To Stored Procedure As Parameter

Feb 25, 2008



I've created a varible timeStamp that I want to feed into a stored procedure but I'm not having any luck. I'm sure its a simple SSIS 101 problem that I can't see or I may be using the wrong syntax

in Execute SQL Task Editor I have
conn type -- ole db
connection -- some server
sql source type -- direct input
sql statement -- exec testStoredProc @timeStamp = ?

if I put a value direclty into the statement it works just fine: exec testStoredProc '02-25-2008'

This is the syntax I found to execute the procedure, I don't udnerstand few things about it.

1. why when I try to run it it changes it to exec testStoredProc @timeStamp = ? with error: EXEC construct or statement is not supported , followed by erro: no value given for one or more requreid parameters.

2. I tired using SQL commands exec testStoredProc @timeStamp and exec testStoredProc timeStamp but nothing happens. Just an error saying unable to convert varchar to datetime

3. Also from SRS I usually have to point the timeStamp to @timeStamp and I dont know how to do that here I thought it was part of the parameter mapping but I can't figure out what the parameter name and parameter size should be; size defaults to -1.

Thank you, please help.

View 2 Replies View Related

Call SSIS Package From Stored Procedure And Pass Parameter

Mar 27, 2008

I am new to the SSIS.

For DTS package of sql server 2000, I can call a DTS package from stored procedure. The command is:

dtsrun /E /SMyServer /NMyDTS /Wtrue /A Parameter1:3= 'Test'

Does anyone know, how do I do the similar thing from SSIS environment.

1) How to call a SSIS package from Stored Procedure?
2) How do I pass parameter to the SSIS package?

Thanks everyone.

View 6 Replies View Related

Pass A Parameter From A SSRS Report To The Sql Stmt In A SSIS Package

Aug 24, 2007

How do I pass a parameter from a SSRS report to the sql stmt in a SSIS package?
Mainly need to know the correct syntax of the connection string to use for the datasource in the SSRS report. Every time I add the /SET part of the string the connection breaks.
The connection string i've been using is:
/file "C:\PackageName.dtsx /Set Package.Variables[StartDate];"&Parameters!StartDate.Value

View 3 Replies View Related

SQL 2012 :: Parameter Error When Executing A Package With Built In Stored Procedures

Jul 23, 2014

I am using Excel VBA to run a stored procedure which executes a package using the built-in SQL Server stored procedures. The VBA passes two values from excel to the stored proc., which is then supposed to pass these "parameters" to the package to use as a variable within the package.

@Cycle sql_variant = 2
WITH EXECUTE AS 'USER_ACCOUNT' - account that signs on using windows authentication
AS
BEGIN
SET NOCOUNT ON;
declare @execution_id bigint

[code]....

When I try to execute the package, from SQL Server or Excel using the Macro I built, I get the following error:"The parameter '[User::Cycle]' does not exist or you do not have sufficient permissions." I have given the USER_ACCOUNT that runs executes the stored procedure permission to read/write to the database and the SSIS project folder.

View 4 Replies View Related

Integration Services :: Pass Multiple Parameter Values To SSIS Package In 2012 Through Stored Procedure?

Jul 9, 2015

we can  assign one parameter value for each excecution of  [SSISDB].[catalog].[set_object_parameter_value] by calling this catalog procedure..

Example: If I have 5 parameters in SSIS package ,to assign a value to those 5 parameters at run time should I call this [SSISDB].[catalog].[set_object_parameter_value] procedure 5 times ? or is there a way we can pass all the 5 parameters at 1 time .

1. Wondering if there is a way to pass multiple parameters in a single execution (for instance to pass XML string values ??)
2.What are the options to pass multiple parameter values to ssis package through stored procedure.?

View 4 Replies View Related

Query With Another Query Input Parameter

Oct 18, 2006

Dear Friends,

I have a long query with an input parameter. I want this input parameter be all teh values returned from another query.



SELECT DIR FROM DIRECCAO

BIG QUERY with DIR input parameter.



How can I do?

Thanks.



View 4 Replies View Related

Query Parameter

Mar 2, 2007

I have to create a stored procedure where the criteria is: "All", specific value and, all except one value so far this is what I have:@Status varchar (50)  -- as parameter from a dropdown boxDECLARE @NewStatus varchar(50)
SET @NewStatus =
CASE
WHEN @Status ='All' AND @Status <> 'All but closed' THEN '%'
WHEN @Status <>'All' AND @Status <> 'All but closed' THEN @Status
END

and in the stored procedure

.........

WHERE Status like @NewStatus  I am a little confused as to how could I return all values except those that have  the value "Closed" Thanks. 

View 2 Replies View Related

Need To Add A Parameter To Query

Mar 23, 2008

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAllArticlesByCatID" TypeName="articlesTableAdapters.tblArticleTableAdapter">
<SelectParameters>
<asp:QueryStringParameter Name="articlecatid" QueryStringField="catid" Type="Int32" />
what goes here?
 
</SelectParameters>
</asp:ObjectDataSource>
I'm using this to populate some templates I'm using.
I need to add a parameter for the query:
SELECT     tblArticle.ArticleCatID, tblArticle.ArticleID, tblArticle.ArticleText, tblArticle.ArticleTitle, tblArticle.Author, tblArticle.ShortDesc, tblArticle.WebSiteID,                       tblWebSite.SiteURL, tblWebSite.PageRankFROM         tblArticle INNER JOIN                      tblWebSite ON tblArticle.WebSiteID = tblWebSite.WebSiteIDWHERE     (tblArticle.ArticleCatID = @articlecatid) and tblArticle.Active=@active
This is from a tableadapter. How to I get the True value passed into this thing?  When an article is initially saved, the active value is set to false until the article is reviewed. Once everything is ok, then the status is set to actve.  So, although everything is sitting there in the table for the article, the directory will not pull it up with other search results already approved.

View 2 Replies View Related

Query: IIf And Parameter

Jul 11, 2007

Hi,Is it possible to create a query with an IIf Function but using a parameter in the expression?This is what I'm trying to do, except it doesn't work:SELECT Related_Area_Id, Course_Code, Course_Public_Title, Course_Level, Course_WBLTTG_OnlyFROM dbo.CourseWHERE (Related_Area_Id = @CurriculumArea) AND (Course_Level = @CourseLevel) AND (Course_WBLTTG_Only = IIf(@Apprenticeship = True, 1, 0)) Are there any other solutions?Thanks

View 2 Replies View Related

Query With Parameter

Aug 28, 2014

I am working with a Report Designer where I am using SQL to get data which user wants to see so I am using parameters.In my SQL database, name and surname columns can not be NULL, but nick can be NULL.The problem is with 3rd parameter ${Nick}. I need to do some condition like this: if user lefts 3rd parameter empty, it should select people where table.nick is NULL, otherwise it should select people by entered nick. But I do not know how to rework my query.

SELECT
table.name,
table.surname,
table.nick

[code]....

View 4 Replies View Related

Parameter Query

Jul 20, 2005

Hi,The following parameter query SQL statement on a sql analyzer gives theerror message given below.Select * from contact where cus_cust_no = ?[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax errorThanks*** Sent via Devdex http://www.devdex.com ***Don't just participate in USENET...get rewarded for it!

View 2 Replies View Related

Need Help With Parameter Update Query

Aug 9, 2006

I am new the asp.net.
I have written the following code and cannot get it to read from my text boxes to assign the values to the parameters.  When I use a fixed value in a string variable and set the parameter to it, I can make it work, but not from the text boxes.
Any help is greatly appreciated.  Thanks
 
Sub btnUpdate_Click(ByVal s As Object, ByVal e As EventArgs)


' Connect to DB
Dim conInventory As SqlConnection
Dim cmdUpdate As SqlCommand
Dim strCommand As String
Dim test As String
test = "hello" 'my attempt to test the sql parameter
strCommand = ""

conInventory = New SqlConnection("server=server;uid=id;pwd=pwd;database=db")


cmdUpdate = New SqlCommand("Update [tw48_inventory] Set [Date]=@Date", conInventory)
cmdUpdate.Parameters.Add(New SqlParameter("@Date", SqlDbType.VarChar, 50))
cmdUpdate.Parameters("@Date").Value = test
'cmdUpdate.Parameters.Add(New SqlParameter("@Date", test)) 'works with constant string value
conInventory.Open()
cmdUpdate.ExecuteNonQuery()

conInventory.Close()


End Sub
Sub Page_Load()
' Connect to DB
Dim conInventory As SqlConnection
Dim cmdSelect As SqlCommand
Dim dtrReader As SqlDataReader

conInventory = New SqlConnection("server=server;uid=id;pwd=pwd;database=db")
conInventory.Open()

cmdSelect = New SqlCommand("Select * From tw48_inventory", conInventory)
dtrReader = cmdSelect.ExecuteReader

dtrReader.Read()

txtDate.Text = dtrReader("Date")
txtHDP.Text = dtrReader("HDP")
txtMDP.Text = dtrReader("MDP")
txtDTPA.Text = dtrReader("DTPA")
txtMAA.Text = dtrReader("MAA")
txtHepato.Text = dtrReader("Hepato")
txtKinevac.Text = dtrReader("Kinevac")
txtSuCo.Text = dtrReader("SuCo")
txtRBC.Text = dtrReader("RBC")
txtCardiolite.Text = dtrReader("Cardiolite")
txtVent.Text = dtrReader("Vent")
txtPaper.Text = dtrReader("Paper")
txtBlackInk.Text = dtrReader("Black_Ink")
txtBlueInk.Text = dtrReader("Blue_Ink")
txtYellowInk.Text = dtrReader("Yellow_Ink")
txtRedInk.Text = dtrReader("Red_Ink")
txtSharps.Text = dtrReader("Sharps")
txtBilling.Text = dtrReader("Billing")
txtEvac.Text = dtrReader("Evac")
txt5_8cc.Text = dtrReader("cc5_8")
txt20cc.Text = dtrReader("cc20")
txtMAG3.Text = dtrReader("MAG3")
txtOther.Text = dtrReader("Other")
dtrReader.Close()
conInventory.Close()

'txtDate.Focus()


End Sub

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>EW 48' Inventory Listing</title>

<link id="Link1" type="text/css" rel="stylesheet" href="~/styles.css" runat="server" />
</head>
<body class="inventory">
<form id="inventory" runat="server">
<div>
<h2>EW 48' Inventory</h2>

<hr class="inventory"/>

<br />

<table width="70%">
<tr>
<td>
<asp:Label ID="lblDate" runat="server" Text="Date: " CssClass="inventory" />
</td>
<td>
<asp:TextBox ID="txtDate" runat="server" width="70" TabIndex="1" />
</td>
<td colspan="6">&nbsp;</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lblHDP" runat="server" Text="HDP: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtHDP" runat="server" Width="50" TabIndex="2"/>
</td>

<td class="spacer">&nbsp;</td>

<td>
<asp:Label ID="lblMDP" runat="server" Text="MDP: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtMDP" runat="server" Width="50" TabIndex="3"/>
</td>

<td class="spacer">&nbsp;</td>

<td>
<asp:Label ID="lblDTPA" runat="server" Text="DTPA: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtDTPA" runat="server" Width="50" TabIndex="4"/>
</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lblMAA" runat="server" Text="MAA: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtMAA" runat="server" Width="50" TabIndex="5"/>
</td>

<td>&nbsp;</td>

<td>
<asp:Label ID="lblHepato" runat="server" Text="Hepato: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtHepato" runat="server" Width="50" TabIndex="6"/>
</td>

<td>&nbsp;</td>

<td>
<asp:Label ID="lblKinevac" runat="server" Text="Kinevac: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtKinevac" runat="server" Width="50" TabIndex="7"/>
</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lblSuCo" runat="server" Text="SuCo: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtSuCo" runat="server" Width="50" TabIndex="8"/>
</td>
<td>&nbsp;</td>

<td>
<asp:Label ID="lblRBC" runat="server" Text="RBC: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtRBC" runat="server" Width="50" TabIndex="9"/>
</td>
<td>&nbsp;</td>
<td>
<asp:Label ID="lblCardiolite" runat="server" Text="Cardiolite: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtCardiolite" runat="server" Width="50" TabIndex="10"/>
</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lblVent" runat="server" Text="Vent: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtVent" runat="server" Width="50" TabIndex="11"/>
</td>
<td>&nbsp;</td>

<td>
<asp:Label ID="lblPaper" runat="server" Text="Paper: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtPaper" runat="server" Width="50" TabIndex="12"/>
</td>
<td>&nbsp;</td>

<td>
<asp:Label ID="lblBlackInk" runat="server" Text="Black Ink: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtBlackInk" runat="server" Width="50" TabIndex="13"/>
</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lblBlueInk" runat="server" Text="Blue Ink: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtBlueInk" runat="server" Width="50" TabIndex="14"/>
</td>
<td>&nbsp;</td>

<td>
<asp:Label ID="lblYellowInk" runat="server" Text="Yellow Ink: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtYellowInk" runat="server" Width="50" TabIndex="15"/>
</td>
<td>&nbsp;</td>

<td>
<asp:Label ID="lblRedInk" runat="server" Text="RedInk: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtRedInk" runat="server" Width="50" TabIndex="16"/>
</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lblSharps" runat="server" Text="Sharps: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtSharps" runat="server" Width="50" TabIndex="17"/>
</td>

<td>&nbsp;</td>

<td>
<asp:Label ID="lblBilling" runat="server" Text="Billing: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtBilling" runat="server" Width="50" TabIndex="18"/>
</td>

<td>&nbsp;</td>

<td>
<asp:Label ID="lblEvac" runat="server" Text="Evac: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtEvac" runat="server" Width="50" TabIndex="19"/>
</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl5_8cc" runat="server" Text="5.8 cc: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txt5_8cc" runat="server" Width="50" TabIndex="20"/>
</td>

<td>&nbsp;</td>

<td>
<asp:Label ID="lbl20cc" runat="server" Text="20 cc: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txt20cc" runat="server" Width="50" TabIndex="21"/>
</td>

<td>&nbsp;</td>

<td>
<asp:Label ID="lblMAG3" runat="server" Text="MAG3: " CssClass="inventory"/>
</td>
<td>
<asp:TextBox ID="txtMAG3" runat="server" Width="50" TabIndex="22"/>
</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="lblOther" runat="server" Text="Other Needs: " CssClass="inventory"/>
</td>
<td colspan="7">
<asp:TextBox id="txtOther" runat="server" Width="540"
TextMode="multiLine" Height="50" TabIndex="23"/>
</td>
</tr>
</table>

<br />
<hr class="inventory"/>

<asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click" />
</div>
</form>
</body>
</html>

View 1 Replies View Related

Query Builder: How To Do A LIKE Parameter

Nov 2, 2006

hi,i can do"select * from products where name = @name" kind of statements in query builder but"select * from products where name LIKE @name" dosen't work!" any ideas?  i'm using sql server express. thanks 

View 3 Replies View Related

Use Results From First Query As Parameter In Second

May 13, 2007

Hello,
I want to select all the customerIDs where an email address exists. Easy: select customerid from customers where emailaddress = @emailaddress
Now I want to use the resulted customerIDs from the above query as a parameter to select all the email addresses with emailstatus equal to 3.
How do I create this type of while statement in a stored procedure? I prefer to not create a temporary table.
My idea was to do it like this:
select emailaddress from emailaddresseswhere emailstatus = 3 and customerid = (select customerid from customers where emailaddress = @emailaddress)
This doesn't seems to work. I get the error:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
thanks

View 4 Replies View Related

Query Table With Same Parameter

Mar 4, 2008

Im struggling with this, I think its probably quite simple. I have a table that looks like this:



RecordId
PictureId
KeywordId

111
212
313
421
522
623
725
817
932
1044
 
I want to be able to run a query for a distinct listing of PictureIds that have KeywordId=1 and Keyword=2. When trying a simple query like:select PictureId from PicturesKeywords where (keywordid=1 and keywordid=2) group by PictureId
It obviously returns nothing. What am I doing wrong?

View 12 Replies View Related

Pass Through Query With Parameter???

Dec 13, 2000

I have the following function that is run when a person
enters a value, "Cell", in an access form. I am trying to
execute the pass through query in SQL Server but i keep
getting the following message:

"The microsoft jet database engine cannot find the input
table or query 'CellDefs'. Make sure it exists and its name
is spelt correctly."


There is nothing wrong with the table name.
I cant understand what the problem is ?????

Can anyone tell me how to execute a query that passes
a parameter from access to Sql server.

Thanks,
Ruaidhri



Public Function GetData(Cell As String)
Dim dbsCurrent As Database
Dim qd1 As QueryDef
Dim SQL As String
Dim rs As Recordset
Dim qdf As QueryDef
Set dbsCurrent = CurrentDb

Set qd1 = dbsCurrent.CreateQueryDef("")
With qd1
.Connect = "ODBC;DSN=MISChief;SERVER=Janeway;UID=sa;PWD=;DATA BASE=MIS"
SQL = ""
SQL = SQL + "INSERT INTO TableX SELECT A.Name AS CellCode, C.FinderNumber"
SQL = SQL + "FROM (CellDefs AS A INNER JOIN Calls AS B ON "
SQL = SQL + "A.CellDef_id = B.CellDef_id) INNER JOIN Finders AS C ON "
SQL = SQL + "B.Finders_id = C.Finders_id "
SQL = SQL + "WHERE A.Name LIKE '" & Cell & "' "
SQL = SQL + "ORDER BY C.FinderNumber"
.ReturnsRecords = False
.ODBCTimeout = 2400

dbsCurrent.Execute (SQL)
End With
dbsCurrent.Close
End Function

View 1 Replies View Related

Parameter Query Issues

Mar 22, 2006

Hi all I am trying to create a parameter in sql getting an error message dont know why?/

View 6 Replies View Related

SQL Parameter Query && Wildcard

Sep 22, 2006

I just migrated a stand alone MSAccess2003 .mdb to an .adp Access Data Project. In the former .mdb I had a parameter query to search for a portion of a 17 character part number, primarily the 2 grouping of 4 digits as in (00-0000-XXXX-0-00). In Access the query was written as

LIKE “*”&[Enter a portion of the part number]&”*”

Then we ported to a web based portal using MSAccess’s DAP (data access pages) and I was told due to ADO vs DAO the query had to be rewritten using the % symbol as in

LIKE “%”&[Enter a portion of the part number]&”%”

So far so good. However with the migration to a SQL Server and ANSI-92 compatible wildcard characters this has changed. The new query looks like this

LIKE @Enter_a_portion_of_the_part_number +n’%’

The problem I am having is the prompt for data entry works but the wildcard will only return matching values from the first digit place holder. Some of the books I have read said to use the Under Score character to move the search criteria to the section I want to search which would be starting with the 9th character (00-0000-XXXX-0-00) as in

LIKE @Enter_a_portion_of_the_part_number +n’________%

However the Under Score only works with Alpha Characters and not Numeric.

So how do I write a SQL Server Query to perform like it did in Access?

View 2 Replies View Related

SQL Parameter Driven Query

Mar 28, 2008

Hi all,

I've a query which i need to run as Parameter Driven, where SQL asks me for an input let's say for a Date in a query. is this possible in SQL SERVER like in Oracle, if so can anybody suggest me where do i look at.

here's my quer.

SELECT * FROM TABLE
WHERE DATE > '1/01/2008'

instead of 1/01/2008 Sql Prompts me to enter my own Date and display the result.

pls.help..me and thanks in advance.

View 2 Replies View Related







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