DB2OLEDB Query Parameters In OLE DB Sources

Aug 10, 2007

Hi

I'm using Microsoft DB2 OLE DB Driver to access a DB2 database, and I have a problem when I create an OLE DB Source using a parameterized query. Everytime I push the "Parameters" button, I get this error:

TITLE: Microsoft Visual Studio
------------------------------

Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command from variable" access mode, in which the entire SQL command is stored in a variable.

------------------------------
ADDITIONAL INFORMATION:

El proveedor no puede derivar la información del parámetro, no se llamó a SetParameterInfo. (Microsoft DB2 OLE DB Provider)

------------------------------

I would really appreciatte any help.

Thanks.

View 5 Replies


ADVERTISEMENT

Report Parameters And Multiple Data Sources

Nov 1, 2007

Hi,

Am having difficulty with report/query parameters, where the report now regularly tells me that I must declare the scalar variable @Site.

I want to use 3 data sources :

1. to select a site from a list of sites - works fine and I can select at runtime

2. Once this is selected - I need to present a pair of dates to the user - min and max for data for the site - needs selection 1 to have been performed. Now I HAVE seen this work - once, the date selectors were greyed out until the site had been chosen, then they became available. Now I get the scalar variable error.

3. Finally I will pull the data with 3 parameters (site, startdate, enddate)


This was almost working, and the detail was produced for item 3, until I introduced the date selection option. Now neither item 2 or 3 will accept the users selected site - its from a drop-down.

All 3 queries are being performed by SQL SP's :

1. exec getsitelist - used to populate the dropdown to select @Site

2. exec getdates @Site - used to preset the start/end dates (NB I would really like calendar control here to select the date, with the value pulled from 1 to set the start point - but hey lets walk first ;-).

3. exec GetData @Site, @Start, @End

SOooo - can SSRS2005 even support dependent parameters of this type ??.

If so - whats the best way to create the parameters etc. ??. NB I can see all 3 parameter defs in 'Report Parameters'.

Many thanks - hopefully - for my sanity :-O.

Regards

Graham

View 1 Replies View Related

Changing The Report Parameters Or Data Sources To The Values You Specified Is Not Allowed

May 24, 2007

I have a report I want to modify and when I go to deploy it I get:



Changing the report parameters or data sources to the values you specified is not allowed. The report is configured to run unattended. Using the specified values would prevent the unattended processing of this report



Now I understand the error, it is because on the report server's web management interface I entered credentials for the report to run that point to a custom datasource and supplied the appropriate credentials to run the report.



However, I don't want to have to reconfigure that just to deploy a slightly modified version of the report.



How can I get around this? Or what is the proper work around? I just want to change the background color from dark gray to light gray on a header column....



Thanks!

View 5 Replies View Related

DB2OLEDB Issue - Possible Bug

Jul 23, 2007

I have several SSIS packages where I am connecting to a DB2 catalog to grab data on a nightly basis. These packages drop/create and reload data from DB2 to both my 2005, 32 bit and 64 bit servers. In the Connection Properties of the packages that reside on my 64 bit server, I am noticing a quirk in setting the password for the DB2 catalog. If I go in and manually type in the password and test the connection, everything is fine. The package will run either right there through Debug Mode, or at the next run time, without any issues. However, as soon as it runs the very next time, the password for the DB2 catalog reverts back to a blank password and the package will fail when it runs the next/second time. I have unchecked the Blank Password box and checked the Allow For Saved Password box on BOTH the Data Link page and the Connection Properties page. But, this does not resolve the issue. It is almost as if it is ignoring the Allow For Saved Password.

The packages are running fine in the 32 bit environment, by the way. I am only experiencing this issue on the 64 bit server.

Thnx in advance, for any suggestions or answers.

Scottye

View 1 Replies View Related

Cross Query Between 2 Sources

Apr 21, 2008

Let say, i've 2 server. Server A having Adb database and Server B having Bdb database.

Adb having tblStaff as follow
ID | Department | Name
------------------------
001 | F41 | James

Bdb having tblDepartment as follow
Department ID | Department Name
-----------------------------------
F41 | Emgineering
F44 | Human Resources

Is it possible to create query between them? Con you consult me. Tq.

View 2 Replies View Related

Microsoft OLE DB Provider For DB2 (DB2OLEDB.DLL)

Mar 10, 2000

Anyone knows where I can find and install the above driver.
Trying to use Link Server from SQL 7.0 to access AS400 database using OLE DB option.
Urgent matter... Help!!!!

Have already tried to find and install this driver using SNA Client Software with out any success. SQL 7 does not come with this OLE DB drivers. Any idea where I can get it.

Thank you in advance....

View 1 Replies View Related

DB2OLEDB For SQL Server 2005 Standard Edition

Sep 19, 2006

The Microsoft OLEDB provider for DB2 (DB2OLEDB) is available in the "Feature Pack for SQL Server 2005 €“ April 2006." The installation routine, however, will only install on the enterprise edition or the developer edition. Is the DB2OLEDB provider not available for SQL Server 2005 standard edition?

View 9 Replies View Related

Move Data From SQL 2005 To DB2/as400 Using DB2OLEDB

Mar 22, 2006



I have a simple SSIS package that I want to move data from SQL 2005 to DB2/AS400. In order to use OLEDDB destination, I installed HIS2004 that provides DB2OLEDB support.

For simplicity and testing purpose, I created a connection pointing to a SQL table that contains only one ccolumn "last_name" of type "nvarchar(50)". This is my source, I then created another connection using DB2OLEDB pointing to a table on DB2 that contains only one field "name" of type "GRAPHIC(50)". This is my destination and the connection works fine to DB2 database. When I run the package, it has type conversion error as follows:

[OLE DB Destination [34]] Error: An OLE DB error has occurred. Error code: 0x00040EDA. An OLE DB record is available. Source: "Microsoft DB2 OLE DB Provider" Hresult: 0x80040E07 Description: "Data or literal value could not be converted to the type of the column in the data source, and the provider was unable to determine which columns could not be converted. Data overflow or sign mismatch was not the cause.".

If I manually assign a vaule to the "last_name" using the "Derived Column" task like "Hello John", it just works fine.

Anyone knows what went wrong? Did I miss anything here? Thanks.

As a FYI: DTS works great in moving data from SQL 2000/2005 to DB2.

Your help will be appreciated.

View 2 Replies View Related

DB2OLEDB Failed To Install On SQL Server 2005 Developer Edition

Aug 20, 2007

I have SQL Server 2005 Developer Edition installed on XP Pro sp2 and have not been able to get OLE DB Provider for DB2 Version 1.0 with Service Pack 1 to install. After getting a notice that the install has failed, I get these log files:

=== Logging started at: 2:12:35 PM Monday, August 20, 2007 Build: 7.0.3038.0 Calling process: H:SQL2005DB2OLEDB7Setup.exe === The current user is NORTHGRUMdinsest. Computer name: DICA2ESITE13005 OS Version: 5.1 Build: 2600 Service Pack: 2.0 Suite: 256 Product Type: 1
[2:12:35 PM Info] Command Line: H:SQL2005DB2OLEDB7Setup.exe
[2:12:35 PM Info] Language: 1033
[2:12:59 PM Info] Raw module path: H:SQL2005DB2OLEDB7Setup.exe
[2:12:59 PM Info] Universal module path: H:SQL2005DB2OLEDB7Setup.exe
[2:12:59 PM Info] Current version of msi.dll is: 3.1 build: 4000 platform: 2
[2:12:59 PM Info] Raw module path: H:SQL2005DB2OLEDB7Setup.exe
[2:12:59 PM Info] Universal module path: H:SQL2005DB2OLEDB7Setup.exe === Logging stopped: 2:12:59 PM Monday, August 20, 2007 === === Logging started at: 2:13:00 PM Monday, August 20, 2007 Build: 7.0.3038.0 Calling process: C:DOCUME~1dinsestLOCALS~1TempEBZ34671.tmpSetup.exe === The current user is NORTHGRUMdinsest. Computer name: DICA2ESITE13005 OS Version: 5.1 Build: 2600 Service Pack: 2.0 Suite: 256 Product Type: 1
[2:13:00 PM Info] Command Line: H:SQL2005DB2OLEDB7Setup.exe /Relaunch /RunningFromTemp /SetupXML C:DOCUME~1dinsestLOCALS~1TempEBZ34671.tmpHISDB2_x86.xml
[2:13:00 PM Info] Language: 1033
[2:13:00 PM Info]
[2:13:00 PM Info] Running prehook init function
[2:13:00 PM Info] Entering PreInitHook
[2:13:00 PM Info] Detecting Sql Server 2005 (32bit)
[2:13:00 PM Info] Enumerating Sql Server 2005 instances from SoftwareMicrosoftMicrosoft SQL ServerInstance NamesSQL
[2:13:00 PM Info] Checking SQL version and edition for: SoftwareMicrosoftMicrosoft SQL ServerMSSQL.1Setup
[2:13:00 PM Info] Got Version 9.2.3042.00
[2:13:00 PM Info] Got edition Developer Edition
[2:13:00 PM Info] Done enumerating Sql Server 2005 instances, original hr = 00000000
[2:13:00 PM Info] Done enumerating Sql Server 2005 instances, hr = 00000000
[2:13:00 PM Info] Done detecting Sql Server 2005, hr = 00000000
[2:13:00 PM Info] Detecting existing integration server installations
[2:13:00 PM Info] Integration server is not installed
[2:13:00 PM Info] Done detecting existing integration server installations, hr = 00000000
[2:13:00 PM Info] Leaving PreInitHook (hr = 00000000)
[2:13:00 PM Info] Prehook Init function returned: 0.
[2:13:00 PM Info] Prehook Init function returned the following mode: 0
[2:13:01 PM Info] Product code: {722CAF00-DE6E-4438-82DE-E664B8B6222B}
[2:13:01 PM Info] Product name: Microsoft OLE DB Provider for DB2
[2:13:01 PM Info] Product PIDSKU: BI6-00082
[2:13:01 PM Info] Product Code (MPC): 91197
[2:13:01 PM Info] OEMID:
[2:13:01 PM Info] Product is not already installed.
[2:13:01 PM Info] Successfully opened Msi package: H:SQL2005DB2OLEDB7Msix86HISDB2.msi
[2:13:01 PM Info] Raw module path: C:DOCUME~1dinsestLOCALS~1TempEBZ34671.tmpSetup.exe
[2:13:01 PM Info] Universal module path: C:DOCUME~1dinsestLOCALS~1TempEBZ34671.tmpSetup.exe
[2:13:10 PM Info] Initializing Component Updater ...
[2:13:10 PM Info] Initialized Component Updater
[2:13:10 PM Info] No updates were found on the SUS server to download.
[2:13:14 PM Info] Required platform components:
[2:13:20 PM Info] Initializing Component Updater ...
[2:13:20 PM Info] Initialized Component Updater
[2:13:20 PM Info] No updates were found on the SUS server to download.
[2:13:20 PM Info] Required platform components: (none)
[2:13:20 PM Info] MSI command line: ADDLOCAL=REQUIRED_FEATURE,OLE_DB_PROVIDER_FOR_DB2 INSTALLDIR="C:Program FilesMicrosoft OLE DB Provider for DB2" PIDKEY="R2D433DHG9DQ79WW3DXQ929DY" USERNAME="Northrop Grumman Corporation" COMPANYNAME="NGGN" FILESINUSEERROR=""
[2:13:20 PM Info] MSI command line is ADDLOCAL=REQUIRED_FEATURE,OLE_DB_PROVIDER_FOR_DB2 INSTALLDIR="C:Program FilesMicrosoft OLE DB Provider for DB2" PIDKEY="R2D433DHG9DQ79WW3DXQ929DY" USERNAME="Northrop Grumman Corporation" COMPANYNAME="NGGN" FILESINUSEERROR=""
[2:13:20 PM Info] Detailed Log information for product H:SQL2005DB2OLEDB7Msix86HISDB2.msi is available at DetailedLog
[2:13:20 PM Info] MSI installation returned 2 - The system cannot find the file specified.
[2:13:20 PM Error] Error 0 occurred during MSI installation.
[2:13:20 PM Error]
[2:13:20 PM Error] === Logging stopped: 2:13:25 PM Monday, August 20, 2007 ===



Detailed Log

=== Verbose logging started: 8/20/2007 14:13:20 Build type: SHIP UNICODE 3.01.4000.2435 Calling process: C:DOCUME~1dinsestLOCALS~1TempEBZ34671.tmpSetup.exe ===
MSI (c) (E4C) [14:13:20:343]: Resetting cached policy values
MSI (c) (E4C) [14:13:20:343]: Machine policy value 'Debug' is 0
MSI (c) (E4C) [14:13:20:343]: ******* RunEngine:
******* Product: H:SQL2005DB2OLEDB7Msix86HISDB2.msi
******* Action:
******* CommandLine: **********
MSI (c) (E4C) [14:13:20:343]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (E4C) [14:13:20:343]: Grabbed execution mutex.
MSI (c) (E4C) [14:13:20:359]: Cloaking enabled.
MSI (c) (E4C) [14:13:20:359]: Attempting to enable all disabled priveleges before calling Install on Server
MSI (c) (E4C) [14:13:20:359]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (B88) [14:13:20:374]: Grabbed execution mutex.
MSI (s) (B8:90) [14:13:20:374]: Resetting cached policy values
MSI (s) (B8:90) [14:13:20:374]: Machine policy value 'Debug' is 0
MSI (s) (B8:90) [14:13:20:374]: ******* RunEngine:
******* Product: H:SQL2005DB2OLEDB7Msix86HISDB2.msi
******* Action:
******* CommandLine: **********
MSI (s) (B8:90) [14:13:20:374]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (B8:90) [14:13:20:406]: MainEngineThread is returning 2
MSI (c) (E4C) [14:13:20:421]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (E4C) [14:13:20:421]: MainEngineThread is returning 2
=== Verbose logging stopped: 8/20/2007 14:13:20 ===



Does anyone have an idea as to why the installation is failing?

TIA,
Steve

P.S. Those aren't really smileys, they're actually semicolon Ds but I can't seem to get rid of the cartoon translation, even after checking the "This post contains a code sample" checkbox.

View 1 Replies View Related

Query Duration Using Parameters Vrs No Parameters

Apr 27, 2006

Hi,
I have an app in C# that executes a query using SQLCommand and parameters and is taking too much time to execute.

I open a SQLProfiler and this is what I have :

exec sp_executesql N' SELECT TranDateTime ... WHERE CustomerId = @CustomerId',
N'@CustomerId nvarchar(4000)', @CustomerId = N'11111

I ran the same query directly from Query Analyzer and take the same amount of time to execute (about 8 seconds)

I decided to take the parameters out and concatenate the value and it takes less than 2 second to execute.

Here it comes the first question...
Why does using parameters takes way too much time more than not using parameters?

Then, I decided to move the query to a Stored Procedure and it executes in a snap too.
The only problem I have using a SP is that the query can receive more than 1 parameter and up to 5 parameters, which is easy to build in the application but not in the SP

I usually do it something like
(@CustomerId is null or CustomerId = @CustomerId) but it generate a table scan and with a table with a few mills of records is not a good idea to have such scan.

Is there a way to handle "dynamic parameters" in a efficient way???

View 1 Replies View Related

SQL Query Parameters

Dec 19, 2006

I am trying to search a SQL database using a TextBox  and a DropDownList. The textbox being where the user enters there search query and the dropdownlist allowing them witch column to search.  If I hardcode in the table column to search everything works fine but as soon as I parameterize the column to search I no longer get any results.   While stepping through the code both parameters do get assigned the correct values to make the sql statement valid.  Any advice would be appreciated.
.... code that does not work .....
            string connection = ConfigurationManager.ConnectionStrings["serverlist"].ConnectionString;            string sqlquery = "SELECT server_id, hostname, os, description, owner FROM server_info WHERE @SearchItem=@SearchQuery";
            conn = new SqlConnection(connection);            comm = new SqlCommand(sqlquery, conn);
            String searchQuery = searchBox.Text;            String searchItem = DropDownList1.SelectedValue;
            comm.Parameters.Add("@SearchQuery", System.Data.SqlDbType.VarChar);            comm.Parameters["@SearchQuery"].Value = searchQuery;            comm.Parameters.Add("@SearchItem", System.Data.SqlDbType.VarChar);            comm.Parameters["@SearchItem"].Value = searchItem;
......

View 1 Replies View Related

Using Parameters In SQL Query

Jul 11, 2007

Hi all,
I am trying to write an sql query in my web application to select some records from the database using parameters. I use SqlClient for that. The query has a WHERE clause where its supposed to values from the various dropdownlists that I have in my application. I bind the SelectedValue from the dropdownlists to the appropriate parameters and the SQL query does not work if all the conditions are satified in the WHERE clause.
Can I have an SQL query where I can provide all the parameters in the WHERE clause (with AND conditions) and it takes only those values where there is some value from the dropdownlist and ignore the rest of the parameters.
This is what I am trying to do:  private DataSet GetSalesDataBas()
{
DataSet ds = new DataSet();
SqlConnection connection = new SqlConnection("...");
SqlCommand command = connection.CreateCommand();

SqlParameter prm_1 = new SqlParameter();
SqlParameter prm_2 = new SqlParameter();
SqlParameter prm_3 = new SqlParameter();
SqlParameter prm_4 = new SqlParameter();
SqlParameter prm_5 = new SqlParameter();
SqlParameter prm_6 = new SqlParameter();
SqlParameter prm_7 = new SqlParameter();

prm_1.ParameterName = "@pNum";
prm_2.ParameterName = "@sNum";
prm_3.ParameterName = "@paramLoc";
prm_4.ParameterName = "@paramDist";
prm_5.ParameterName = "@paramPNum";
prm_6.ParameterName = "@paramDesc";
prm_7.ParameterName = "@paramBuild";

prm_1.Value = TextBox2.Text.Trim();
prm_2.Value = TextBox3.Text.Trim();
prm_3.Value = DropDownList15.SelectedValue;
prm_4.Value = DropDownList12.SelectedValue;
prm_5.Value = DropDownList21.SelectedValue;
prm_6.Value = DropDownList13.SelectedValue;
prm_7.Value = DropDownList18.SelectedValue;

command.Parameters.Add(prm_1);
command.Parameters.Add(prm_2);
command.Parameters.Add(prm_3);
command.Parameters.Add(prm_4);
command.Parameters.Add(prm_5);
command.Parameters.Add(prm_6);
command.Parameters.Add(prm_7);

string strWhere = "";

if (DropDownList23.SelectedIndex == 0)//if no sort field selected
{
strWhere = @" WHERE ""UserName""='" + userName + "' AND ([Status] LIKE 'REF%A' OR [Status] LIKE 'A%')" +
" AND m.[Part Number] LIKE '%' + @pNum + '%'" +
" AND m.[Serial Number] LIKE '%' + @sNum + '%'" +
" AND (Location = @paramLoc" +
" AND m.[District] = @paramDist" +
" AND m.[Part Number]= @paramPNum" +
" AND m.[Description]= @paramDesc" +
" AND m.[Building]= @paramBuild" +
")";
}
else
{
strWhere = @" WHERE ""UserName""='" + userName + "' AND ([Status] LIKE 'REF%A' OR [Status] LIKE 'A%')" +
" AND m.[Part Number] LIKE '%' + @pNum + '%'" +
" AND m.[Serial Number] LIKE '%' + @sNum + '%'" +
" AND (Location= @paramLoc" +
" AND m.[District]= @paramDist" +
" AND m.[Part Number]= @paramPNum" +
" AND m.[Description]= @paramDesc" +
" AND m.[Building]= @paramBuild" +
")" +
" ORDER BY " + DropDownList23.SelectedValue + " " + DropDownList24.SelectedValue;
}

string sqlSalesData = @"SELECT * FROM Main m" + strWhere;
command.CommandText = sqlSalesData;
SqlDataAdapter salesOrderAdapter = new SqlDataAdapter(command);
salesOrderAdapter.Fill(ds, "Main");
salesOrderAdapter.Dispose();
command.Dispose();
return ds;
}    

View 7 Replies View Related

DTS Query Parameters

Mar 14, 2002

I am creating a package within which I have a query step that needs to accept
a value from a variable step that has already been run, but I cant get it to work and the books online dont help!

The query is simple

insert into table1
select col1 = cola,
col2 = colb,
col3 = ?
from tableA

Even though the variable that I want use has been set, I cant get the query to recognise there are any parameters. If I click the parameter button in the query set-up, I get a message saying that col3 is an invalid column name and then a box saying that an error occured when parsing the statement fro parameters !

Can anybody help ?
Thanks
Tom

View 1 Replies View Related

Parameters For Query

Oct 19, 2006

I'm not sure if any1 can answer is on this forum, but any help would be VERY appriceted....

I am creating a report using Visual Studio.Net..I want to write a query using parameters BUT in this case I dont no what the parameter will be...

ie the user can enter a customer account OR a customer group
and sort can be on product OR total sales...

Any ideas?!

Thanks!!! :)

View 9 Replies View Related

MDX Query With Parameters

Jul 25, 2007

Hi there,

I'm developing one MDX query to place in my report, but I'm having a lot of troubles when using one of my report parameters.

I hope I can explain me good enough.

I have a report parameter that's used in the WHERE clause to choose the value of one of my dimensions, the problem is that I'm also trying to compare the value of this parameter to decide the value of another dimension, but the comparison isn't working at all.

Let me show one example:

The parameter name in question is: DimFolderWalletDesciption.




Code Snippet


IIF(
@DimFolderWalletDesciption = [Dim Folder].[Wallet Desciption].&[Investimento],
[Dim Indexation].[Indexation Group].[Rendimento Variável],
[Dim Indexation].[Indexation Group].[Indexation Group].ALLMEMBERS
)


This is suppost to do the following: If my parameter as the selected value "Investimento", then the "Indexation Group" selected should be "Rendimento Fixo" if not, there shouldn't be any "filter" in the Dimension "Indexation Group".

I've tryed a lot of combinations, but none works, what am I doing wrong?

Thanks in advance.
Regards.

View 1 Replies View Related

Update Query With Parameters

Apr 18, 2007

I have a web form that is populated from the DB values. User can update teh record by keying in new values in the form fields. In my .vb class file I have an update statement -
strSql = "UPDATE msi_Persons SET Firstname=@firstname where Id=@id"
 I have the parameters defined as
cmd.Parameters.Add(New SqlParameter("@firstname", _FirstName))
cmd.Parameters.Add(New SqlParameter("@id", _Id))
 _FirstName & _Id are the private variables whose values a set thru set and get methods.  I expect _FirstName to have the new value I am keying in the form.
Can any body help me with what's wrong here? This is not updating the database. When I do trace.write it shows me the Update statement as "UPDATE msi_Persons SET Firstname=@firstname where Id=@id" instead of @firstname and @id being replace by actual values.
Please help.
Thanks,Shaly

View 23 Replies View Related

How Can I Execute SQL Query From DOS With Parameters?

Feb 8, 2007

I believe all of us use SQL Server Management Studio to execute query. As I encountered serious problem with this method, due to typo error by accident, I am wondering if we can run the .sql file from dos and supply parameters with it.Possible?

View 4 Replies View Related

Query - Scanning Of Parameters

Mar 6, 2007

Hi all. I have a problem on my query. let me explain first the scenario.

I have a windows application project that views a report through report viewer(Report of all employees that have a religion of adventist, born again, catholic, baptist, etc....). In my windows application, I have checkboxes for a specific religion. So, if I checked baptist and catholic, report generated is all employee that has religion of baptist and catholic.

My concern is, How could i make a query of this?

sample tables.
table - employee
dcno name religion
1 jon baptist
2 rose catholic
3 joy baptist
4 mike adventist
5 soy born again
6 rich protestant

you can supply additional table if needed.

thanks
-Ron-

View 7 Replies View Related

LOOKUP: Specifying Parameters For The SQL Query

Jul 18, 2006

guys i'm trying to use a Lookup in a dataflow that looksup stuff in the results of a query.

Problem I have is that the query needs to take two parameters.. (Source
and BaseCurrency in the code below) and i can't figure out how to
supply the parameters..

Parameters can be supplied in other task types or transforms .. but can't see how to do it in the Lookup...



PJ



SELECT ForeignCurrency, RateFromFile AS YesterdaysRate

FROM inputrates IR

WHERE fileheaderid in (

SELECT top 1 MAX(ID)
FROM FileInputAttempts FIA
WHERE Source = '?'
AND FIA.BaseCurrency = '?'
AND status = 'SUCCESS'
Group by CAST(FLOOR(CAST(LoadDate AS float))AS datetime)
order by MAX(loaddate) DESC
)

View 10 Replies View Related

Getting ORA-01036 When Using Query Parameters

Dec 13, 2007

I'm adding parameters to an already working query for a standard report I'm building. The object I am connecting to is an Oracle object (I have SP2 installed in all the appropriate places). I'm changing two date comparisons from hard coded date values to two query parameters. Based upon what MS's Step by Step book on Reporting Services is telling me, I have my query parameters correctly pointing to my Parameters collection. Thing is, when I click the preview button, I get subject error message -- "illegal variable name/number". Here's my query:

SELECT S.COVER_DATE, S.AD_NBR, S.APP_NBR, S.PRODUCT, S.EDITION, S."SECTION", S.PROGRAM_RATE, S.NET_AMT, S.ACCOUNT_ID,
ACT.SALES_ID
FROM MDTI.SCHEDULE S INNER JOIN
MDTI.ACCTSALES ACT ON S.ACCOUNT_ID = ACT.ACCOUNT_ID AND S.PRODUCT = ACT.PRODUCT
WHERE (S.COVER_DATE BETWEEN "@StartCoverDate" AND "@EndCoverDate") AND



(ACT.EXPIRE_DATE > '30-NOV-07') AND
(ACT.EFFECTIVE_DATE < '01-DEC-07')

The query parm names start with "@" in the WHERE clause. Nothing to it, right?

Any ideas why I am getting this error? SBS is telling me that I must select the Oracle data provider instead of the generic ODBC data provider in the Data Link Properties of my data source. I can't get anyone to show me where the Data Link properties are.

I'm looking for a solution to this error.

Respectfully Submitted,

Dave Matthews
Atlanta, GA
aka FlooseMan Dave

View 5 Replies View Related

Query Parameters Vs.Filters

Mar 23, 2008

I am developing a summary report that will have multiple tables, charts and matrixes, all using the same set of data. However, one table may only show one month of data while another will show three months. If they all use the same Dataset with the same data parameters, is the data only pulled once? And then each component can use Filters to further refine the data? If this is true, this would seem to be the best option.

Or does each report component execute the query independantly?

Before I get too far down the road developing this report, I'd like to know the best way to do it from the beginning.

Thank you for your input.

Rob

View 3 Replies View Related

Using Two Parameters To Query The Same Column ID

Mar 17, 2008

I am trying to build a report that has two parameters that are entered by the user. They will be a simple string that is basically a six digit unique identifier number called DEALID. I have my report set so that I can enter one of these Deal ID's and it will pull in all of the fields I need. However, within the same report I want to have the user be able to enter a second Deal ID and have it pull in effectively the same values, yet associated with that new ID.
The problem seems to be that I am trying to have multiple parameters querying the same field in the database. Is this something that can be done? I have tried naming them all uniquely with a new alias and that does not seem to help.

Thank you

View 16 Replies View Related

Parameters In Sql Task Sub Query

Oct 9, 2006

DELETE T1
WHERE EXISTS
(SELECT *
FROM T2 A
WHERE A.C1= T1.C1
AND A.C3 >= ?)


Results in below error (OLEDB SQL TASK):

" failed with the following error: "Parameter Information cannot be derived from SQL statements with sub-select queries. Set parameter information before preparing command.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Any resolution?

View 9 Replies View Related

Query A Linked Server With Parameters

Apr 20, 2001

I need to query a linked server (which is Oracle) with some parameters. When I try to use a four part SQL statement, it does not work. But when I try to use OPEENQUERY statement, it works just fine. Problem comes when I need to send some parameters with the OPENQUERY'S 'query' part.

For example, the following statement works just fine:

SELECT *
FROM OPENQUERY(OracleLinked, "SELECT ACCOUNTNUMBER, POSTINGDATE FROM ORA_SERVER.FINANCEENTRY WHERE DATEOFENTRY BETWEEN '2000.01.01' AND '2000.01.31'")


But If I try to use:

DECLARE @DynamicSQL VARCHAR(1000),
@StartDate VARCHAR(10),
@EndDate VARCHAR(10)
SET @StartDate = '2000.01.01'
SET @EndDate = '2000.01.31'

SELECT @DynamicSQL = "SELECT ACCOUNTNUMBER, POSTINGDATE FROM ORA_SERVER.FINANCEENTRY WHERE DATEOFENTRY BETWEEN '" + @StartDate + "' AND '" + @EndDate + "'"
--SELECT @DynamicSQL

SELECT *
FROM OPENQUERY(OracleLinked, @DynamicSQL)

it does not work.

Well, I did some research and found out that OPENQUERY does not accept variables for its arguments. See the link below:(http://msdn.microsoft.com/library/psdk/sql/ts_oa-oz_5xix.htm)

Then is there any way I can accomplish what I want to on the Remote server?

Thanks in advance for your help.

View 1 Replies View Related

Search Query With Optional Parameters

Jun 12, 2006

I need to create a stored procedure that will search some tables.

The stored procedure will be passed some parameters that may or may not have a value.

I have googled the best way to do this.
I found this post as an example: Optional Search Parameters

and also found this example : Optional Parameters in T-sQL

I am trying to figure out the best way to do this.

In the past I would build a dynamic query like the following.


SQL Code:






Original
- SQL Code




CREATE PROCEDURE [dbo].[Search_Results]

@SUBCITY VarChar(100) = 'Any'

AS

------------------------------------------------------------------------------------------------------
Declare @SUBCITYString Varchar(200)
If @SUBCITY <> 'Any'
Begin
Set @SUBCITYString = ' AND (Table1.SUBCITY LIKE ''' + @SUBCITY + '%'') '
End
Else
Begin
Set @SUBCITYString = ''
End
-----------------------------------------------------------------------------------------------------

Declare @SQLString As Varchar(500)
Set @SQLString = 'SELECT*

FROMTable1

WHERE Table1.ID IS NOT NULL
' + @SUBCITYString + '

ORDER BY Column ASC'

Execute (@SQLString)

GO






CREATE PROCEDURE [dbo].[Search_Results]  @SUBCITY VarChar(100) = 'Any' AS ------------------------------------------------------------------------------------------------------DECLARE @SUBCITYString Varchar(200)IF @SUBCITY <> 'Any' BEGIN  SET @SUBCITYString = ' AND (Table1.SUBCITY  LIKE ''' + @SUBCITY + '%'') 'ENDELSE BEGIN SET @SUBCITYString = '' END----------------------------------------------------------------------------------------------------- DECLARE @SQLString AS Varchar(500)SET @SQLString = '  SELECT    *                            FROM  Table1               WHERE  Table1.ID IS NOT NULL                ' + @SUBCITYString +  '            ORDER BY Column ASC' Execute (@SQLString) GO


However this is really cumbersome to create and is not fun debugging!

Does one of these ways have an advantage over the other? Or is there another way to do this?

Thank you!

View 2 Replies View Related

Pass Parameters To A Query Using Subquery?

Apr 23, 2012

I don't know how to pass parameters required (dates) to a query1, if I'm using a subquery (query2) which is using the results of query1, but I'm not showing that field on that subquery (query2)

Example

table1
id - autonumeric
id_user - id from user
dates - date of register

table2
id - user id
name - user name

query1
SELECT Table1.id_user, Count(Table1.id_user) AS CuentaDeid_user
FROM Table1
WHERE (((Table1.datess) Between [begining] And [ending]))
GROUP BY Table1.id_user
ORDER BY Table1.id_user;

subquery (query2)
SELECT query1.id_user, query1.CuentaDeid_user, Table2.name
FROM query1 LEFT JOIN Table2 ON query1.id_user = Table2.id;

This is just an example, the think is that I want to know that if it's possible to pass the parameters requested in query1 from the SQL of the subquery (query2)?

View 3 Replies View Related

T-SQL (SS2K8) :: Appropriate Query For Multi Parameters?

Mar 13, 2014

I am using the following code in my query to fetch data for my ssrs report which have a parameter @auditCode, where multiple auditCodes can be inputted to generate the report.

Is there any other way I can achieve the same functionality avoiding the part charindex(LU.auditCode,@auditCode)<>0 , as it will return wrong results.

For instance, it will return, the results for the audit code ‘INPS45’ and ‘INPS450000’ when audit code ‘INPS45’ is inputted.

SELECT distinct Ac.activityCode,
Ac.ActivityName + isnull(Ac.description,'') AS ActivityName,
Ac.activityStartDate, Ac.activityEndDate,
LU.auditCode,
LU.AuditName,
St.studyCode AS StudyCode,
St.StudyName AS StudyName

[Code] ....

View 3 Replies View Related

Dynamic Query With Multi-value Parameters

Jun 1, 2008

Is anybody here knowing how to create a dynamic query based on a multi-value parameter?

e.g. there is a multi-value report parameter called names. For a static query, the where clause of a select statement likes the following

select * from students where name=@names

For the dynamic one, I tried something like the below, but it did not work.

="select * from students where name=(" & Join(Parameters!names ,',') & ")"

Any suggestion would be great appreciated.



Thanks,
KY

View 2 Replies View Related

Query With Parameters Not Returning Right Results

Mar 19, 2008

I havea 2 part issue with a query I'm trying to run for a report.

I have an incident report that needs to show results based on dates from the week before. In addition, This report should run every Monday morning, with the exception of a Monday holiday, where in that case, the report will run the next business day. I have an idea to use a case statement, but it doesn't seem to work for me. Any suggestions?

Also,part of the query I have is pulling back the right data, as long as I don’t include parameters. When I do add values to the parameters the query includes all the dates. I need to see either/or - not both. I just want to either see dates without the param values or see only dates that I ask for in a parameter. Does that make sense?

Here’s the query (thanks!):

SELECT incident.incid_id,
incident.incid_short_desc,
incident.incid_received_date_time,
incident.incid_closed_date_time,
security_users.description,
incident.incid_assigned_to,
incident.tagged_delete_flag,
activity_result_master.result_desc,
incident_priority_master.priority_desc,
activities.result_id

FROM activities AS activities INNER JOIN
incident AS incident ON
activities.incid_id = incident.incid_id INNER JOIN
activity_result_master AS activity_result_master ON
activities.result_id =
activity_result_master.result_id
INNER JOIN security_users AS security_users ON incident.incid_assigned_to = security_users.name INNER JOIN
incident_priority_master AS incident_priority_master ON incident.priority_id = incident_priority_master.priority_id

WHERE incident.tagged_delete_flag = 'N' AND
activities.result_id = '6' AND
(incid_received_date_time >= DATEADD (d,-7,GETDATE()) AND
incid_closed_date_time <=DATEADD (d,-3,GETDATE())) OR
CONVERT(varchar,incident.incid_received_date_time,101) >= @StartDate AND CONVERT(varchar,incident.incid_closed_date_time,101) <= @EndDate

ORDER BY incident.incid_assigned_to, incident.incid_id

View 2 Replies View Related

How To Write A SQL Update Query Using Parameters?

Mar 23, 2008

Hi, could someone explain to me with sample code how to write a sql query using parameters to update a record, as I am new to this.

thanks

View 4 Replies View Related

Help Designing Query For Any Number Of 5 Parameters

Nov 27, 2007

Hello everyone,

I'm having trouble designing a query for an ASP.NET project I'm working on. The main portion of the query is done and works, but I need to modify it to accept 5 parameters. Below is the main query:





Code Block

@LocID as nvarchar(10)

SELECT dbo.ProfileNames.Name, dbo.AircraftGateInput.*
FROM dbo.ProfileNames
LEFT JOIN dbo.AircraftGateInput
ON dbo.ProfileNames.Name = dbo.AircraftGateInput.Gate
WHERE dbo.ProfileNames.Type = 'Gate' AND dbo.ProfileNames.Location = @LocID
The changes I need to make to this are confusing me because I've had to do something like this before. There are 5 DropDownLists on the page the user can select as parameters for searching/filtering the information. The query above is what's being used now, and causes the page to dynamically generate a certain number of colums based on the number of returned columns.

The parameters that are available are: Gate, Location, Offload Zone, Onload Zone and Equipment. I wwant the user to be able to select all or any number of these as search options but I'm not really sure how to design the query to do this. A co-worker suggested doing something like this:





Code Block

@LocID as nvarchar(10),
@Gate as nvarchar(50),
@Location as nvarchar(50),
@OffLZ as nvarchar(50),
@OnLZ as nvarchar(50)

SELECT dbo.ProfileNames.Name, dbo.AircraftGateInput.*
FROM dbo.ProfileNames
LEFT JOIN dbo.AircraftGateInput
ON dbo.ProfileNames.Name = dbo.AircraftGateInput.Gate
WHERE (dbo.ProfileNames.Type = 'Gate') AND (@Gate IS NULL OR dbo.ProfileNames.Name = @Gate)

AND (dbo.ProfileNames.Location = @LocID)


AND (@Location IS NULL OR dbo.AircraftGateInput.Location = @Location)
AND (@OffLZ IS NULL OR dbo.AircraftGateInput.OffLZ = @OffLZ)
AND (@OnLZ IS NULL OR dbo.AircraftGateInput.OnLZ = @OnLZ)
At this point I'm not a 100% sure on how to test this query in the query designer in Management Studio 2005 (this is also a .NET 2.0 project). If anyone can help, I'd really appreciate it, thanks.

View 3 Replies View Related

Passing Parameters To AS400 Query

Dec 5, 2007

Hello,

I'm using

IBM DB2 UDB for iSeries IBMDA400 OLE DB Provider
to extract data from AS400 and copy them to SQLServer2005. It's my first experience with exptracting data from AS400.

I need to pass in SSIS a parameter to the extract query like
SELECT dtses
FROM oslglf3.flp016
WHERE dtses > ?

I'm naming the parameter in the mapping as 1 but geetting an error
[as400 [1]] Error: The SQL command requires a parameter named ""00001"", which is not found in the parameter mapping.

I have tried 00001, '00001', ("00001" is not accepted from SSIS) but getting still this error.

A query like
SELECT dtses
FROM oslglf3.flp016
WHERE dtses > '1071205'
works OK.

Can anybody help me ?

thanks in advance

View 7 Replies View Related

Parameters For Lookup Transformation Query!

Aug 2, 2007

Hi Gurus,
I have a Dataflow Task which has an OLE DB Source calling a SP with parameters (?, ?). Then this OLE DB Source is conencted to a Lookup Transform which also calls a SP but on a different database. I am unable to figure out how to pass parameters in a Look up Transform.
In the 'Use Results of an SQL Query' pane of Lookup Transform:



Code SnippetEXEC GetMonthlyDataExtract 4, 2007

( I am passing month and year values) this works ok.


But when I chage to



Code SnippetEXEC GetMonthlyDataExtract ?, ?





It says EXEC not supported. Also I can not figure out how to configure parameters since 'Reference Table' Tab of the Lookup Transform does not have any option where we can attach variables to parameters.
Also I am interested to map parameters to variables not to input columns.
If mention if that is not possible or any other alternative.

Your help will be appreciated.

Thanks,
Paraclete

View 3 Replies View Related







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