I need some help...
I'm trying to execute a stored procedure and I'm getting this message
Run-Time Error '-2147217887 (80040e21)':
[Microsoft][ODBC SQL Server Driver]Optional feature not implemented
Here is the code:
Public Function D2L(sconnect As Variant, dDate As Variant) As Variant
Dim rsDate As ADODB.Recordset
Dim cmdDate As ADODB.Command
Dim prmDate As ADODB.Parameter
Set cmdDate = New ADODB.Command
Set ADOConn = New ADODB.Connection
ADOConn.Open sconnect
Set cmdDate.ActiveConnection = ADOConn
cmdDate.CommandText = "dbo.UP_CVRT_DATE_TO_LONG"
cmdDate.CommandType = adCmdStoredProc
Set prmDate = New ADODB.Parameter
prmDate.Type = adDate
'prmDate.Size = 32
prmDate.Direction = adParamInput
prmDate.Value = dDate
cmdDate.Parameters.Append prmDate
i need to know in which language the standard SQL is implemented.. and that from where can i get the code.. i need the code for the "logical operators" of SQL.
I wanted know that is it possible to implement mirroring in C#.NET framework using SMO (I need specifically a web applicaton). which willl provide a naive user the facilities integrated in SSMS. I am using VS.NET 2005 and SQL Server 2005 SP1. Thanks and Regards, Adii
This is a question to the SSIS development team. I would like to know what are the requirements to implement custom SSIS Control Flow task in C++ . There is a documentation describing the process when implementing a managed task, but no such documentation exists for implementing a task in C++.
Service Broker will let you create two services with the same name (one with contract and another without)
CREATE SERVICE [Order Msg Recieve] AUTHORIZATION [dbo] ON QUEUE [dbo].[Order Return Msg Queue]
CREATE SERVICE [Order Msg Receive] AUTHORIZATION [dbo] ON QUEUE [ODS].[Order Return Msg Queue] ([OrderSubmission])
When you delete the service....
drop service [Order Msg Recieve]
It will only drop the first one. In the BOL there is no syntax for telling it to delete the second one, however you can drop it from SQL Management Studio.
When upgrading a database from MSDE to Visual Studio 2005 Express, I've noticed that the system tables in the MSDB database don't get upgraded. For example, the SYSSCHEDULES table doesn't get added. Is this by design or a bug?
Hi, how can i make optional relationship? for example: In table A, there is column 1, column 2, column3. In table B, there is column 4, column 5 and column 6. column 1 and column 2 are primary keys for table A and table B. The relationships between table A and table B are column 2 and column 5; column3 and column 6. but optional (ie. when data exists in column 2, then column3 is null) how can i set the relationship? because one of the columns data is null each time, error always occurs.
I have a select proc that will take a bunch or criteria parameters. Based on how many are not null I would like to decide how many inner joins to do. for example:
select H1.Priceid as HotelPriceId,H2.Priceid as AirPriceId, H1.VendorPackageId from ( select HA.PriceId, HA.VendorPackageId from Criteria HA Inner Join ( select VendorPackageId from ValidVendorPackages where Vendor = 'SBT' and Sitecode = 'system' and PackageType = 'AHCF' )HB on HA.VendorPackageId = HB.VendorPackageId and ( CriteriaId in ( select CriteriaID from ValidItemCriteria where Destination = 'LAS' and LengthOfStay = 5 and Ages = 'A2' and ComponentType = @ComponentType_1 and ValidItemType = @ValidItemType_1 and ItemValue = @ItemValue_1 ) )
)H1 INNER JOIN ( select HA.PriceId, HA.VendorPackageId from Criteria HA Inner Join ( select VendorPackageId from ValidVendorPackages where Vendor = 'SBT' and Sitecode = 'system' and PackageType = 'AHCF' )HB on HA.VendorPackageId = HB.VendorPackageId and ( CriteriaId in ( select CriteriaID from ValidItemCriteria where Destination = 'LAS' and LengthOfStay = 5 and Ages = 'A2' and ComponentType = @ComponentType_2 and ValidItemType = @ValidItemType_2 and ItemValue = @ItemValue_2 ) ) )H2 on H1.Priceid = H2.priceId Inner Join ( select HA.PriceId, HA.VendorPackageId from Criteria HA Inner Join ( select VendorPackageId from ValidVendorPackages where Vendor = 'SBT' and Sitecode = 'system' and PackageType = 'AHCF' )HB on HA.VendorPackageId = HB.VendorPackageId and ( CriteriaId in ( select CriteriaID from ValidItemCriteria where Destination = 'LAS' and LengthOfStay = 5 and Ages = 'A2' and ComponentType = @ComponentType_3 and ValidItemType = @ValidItemType_3 and ItemValue = @ItemValue_3 ) ) )H3 on H2.Priceid = H3.priceId
if values are only passed in from @ComponentType_1,@ValidItemType_1,@ItemValue_1 I dont want to do any inner joins.
If its passed in for @ComponentType_1,@ValidItemType_1,@ItemValue_1 & @ComponentType_2,@ValidItemType_2,@ItemValue_2 I want to do the first Inner Join.
and of course if I get all 3 sets of criteria I want to do both the inner joins. I know I can cut and past this thing 3 times with an if statement but that isn't going to be practical.
Is it possible to define an argument as optional for a UDF? I have a financial calculation that may or may not require a defined date range depending on the status of an individual item. Is there a way to avoid requiring the date range where it's not necessary?
AS SELECT * FROM myTables with joint WHERE DepartureDate = @DepartureDate AND ReturnDate = @ReturnDate AND MaxPrice = @MaxPrice AND Country = @Country
If a parameter is null, I dont want it to be in the WHERE clause. I dont want to use a string parameter and execute a "string" select. I dont want to use a combination of IF to check everything ...
Is there an option in a stored procedure whereby a parameter can be flagged as optional? I have a stored procedure with 2 parameters, Product and Date, and I would like to be able to just pass the Product, or pass Product and Date from an Access project. Is this possible?
Hello, Is it possible to define optional parameters for a stored procedure? What I want is to create a search with about 8 parameters, but most users will only use 3 or 4, so It would be nice If I could only provide the used parameters in my code. And have sql give the unused parameters a default value (possibly %) thx.
I have a package in DTS that I am tryinig to work with. We have a few queries that will export the same exact table to a text file. I am trying to make it so we can pull a previously created text file from a central "CommonFile" folder. In this package I have a Execute Package Task. This second package is only for creating this common txt file. I want this step to only run if the file is non-existant (i.e. someone deleted/moved it by accident) or if it is over a week old (the database we pull it from it updated on sundays). I can run it so the comment txt file get created first thing on monday, but I still want a failsafe in there incase the file is deleted/moved or the package to create it fails.
I have an ActiveX script set up which checks if the file exists and if it does then checks to see how old it is Then from there I would like to jump to a different area of my package:
Code Snippet
Dim pkg Dim stpbegin
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(".txt") = TRUE THEN msgbox("COPY") Set objFile = objFSO.GetFile(".txt")
Dim today Dim thisweek
today = date() thisweek = (Weekday(date())-2)
IF thisweek < 0 THEN thisweek = 6 'Sunday Weekday() = 1 so this will put it at the end of the week.
IF (date() - thisweek) <= objFile.DateLastModified THEN msgbox("COPY") set pkg = DTSGlobalVariables.Parent set stpbegin = pkg.Steps("DTSStep_DTSActiveScriptTask_4") stpbegin.ExecutionStatus = DTSStepExecStat_Waiting ELSE msgbox("CREATE") set pkg = DTSGlobalVariables.Parent set stpbegin = pkg.Steps("DTSStep_DTSExecutePackageTask_1") stpbegin.ExecutionStatus = DTSStepExecStat_Waiting END IF
ELSE msgbox("CREATE") set pkg = DTSGlobalVariables.Parent set stpbegin = pkg.Steps("DTSStep_DTSExecutePackageTask_1") stpbegin.ExecutionStatus = DTSStepExecStat_Waiting END IF
Main = DTSTaskExecResult_Success End Function
The problem I am having is despite the ActiveX script the package will run the execute package task no matter what (i dont see a way to post pics so I will try to draw bellow). I think this is due to me having a success between the ActiveX and the EPT. This is the only way I know of how to step this up. If i do a completion it will also do the EPT and if I do a failure it won't do anything at all after it.
So basically I want this pagage to jump over the DTSExecutePackageTask_1 if the file checks out as okay. Does anyone have a suggestion of how I can set up this package?
I'm using an application that is generating some SQL scripts for SQL Server 2005. I'm trying tweak it so that I can run it on SQL Server 2000.
The line that I'm having trouble with is:
CREATE INDEX FKFFF41F9960601995 ON alf_access_control_entry (permission_id);(optional)
The key word "(optional)" is causing trouble. I understand this keyword, when used in SQL Server 2005, let's the script continue and complete when errors are detected.
What is the alternative syntax to use in SQL Server 2000?
Hi, I'm having a problem trying to do optional items in where clause. I'd appreciate some help, heres the code.
select DFD.Col1 as 'Col1',CMD.Col2 as 'Col2' from Control as DFD,MetaData as CMD,Columns as DC,Tables as DT where DFD.GroupID in ({0}) and
(CMD.MetaDataId = DFD.PrimaryID -- or CMD.MetaDataId = DFD.ForeignID -- These are the problem 3 lines or CMD.MetaDataId=DFD.HumanColumn) --
and DFD.Disabled='N' and CMD.Disabled='N' and DC.ColumnsId=CMD.ColumnId and DC.Disabled='N' and DT.TablesId=DC.TableID and DT.Disabled='N'
-- For the problem rows I need to be able to optionally search if they're = to MetaDataID. Right now this query will return only rows that have metadataid = PrimaryID or Foreign, Human. I need to be able to return all rows with the optional dependancies.
Try this in sql server 2005: select COALESCE(a1, char(254)) as c1 from (select 'Z' as a1 union select 'Ya' as a1 union select 'Y' as a1 union select 'W' as a1) as b1 group by a1 with rollup order by c1 select COALESCE(a1, char(255)) as c1 from (select 'Z' as a1 union select 'Ya' as a1 union select 'Y' as a1 union select 'W' as a1) as b1 group by a1 with rollup order by c1
The only difference is that the first one uses 254 and the second one uses 255. The first sorts like this: WYYaZþ The second one sorts like this: WYÿYaZ Is this expected behavior?
Has anyone noticed that if you created DTS package and try to change connection properties (i.e. change DSN or redirect DTS to different server or Database), as soon you click OK it does not save new password and hence does not work anymore. In my case to move Database from Development to Production server I would have to recreate all DTS packages. Is there any way around it?
CREATE TABLE ItemInformation([Description] varchar(80)) GO
INSERT INTO ItemInformation([Description]) SELECT 'CHOCOLATE CHIP‚' UNION ALL SELECT '‚COOKIES‚' UNION ALL SELECT '‚CROISSANTS *PLAIN*‚' UNION ALL SELECT '‚DONUTS‚' UNION ALL SELECT '‚DONUTS *DOZEN*‚' UNION ALL SELECT '‚MUFFINS‚' UNION ALL SELECT '‚BAGELS‚' UNION ALL SELECT '‚ROLLS‚' UNION ALL SELECT '‚CUPCAKES‚' UNION ALL SELECT '‚CRISPIES‚' UNION ALL SELECT '‚DANISH/SWEET ROLLS‚' UNION ALL SELECT '‚FUDGE BROWNIES‚' UNION ALL SELECT '‚PUFF PASTRIES/ECCLES‚' UNION ALL SELECT '‚STICKY BUNS‚' UNION ALL SELECT '‚TURNOVERS‚' UNION ALL SELECT '‚BLACK & WHITE COOKIES‚' UNION ALL SELECT '‚LINZER TARTS‚' UNION ALL SELECT '‚SCONES/BISCUITS‚' UNION ALL SELECT '‚SCUFFINS‚' UNION ALL SELECT '‚SINFULL BITS‚' GO
SELECT * FROM ItemInformation GO
UPDATE ItemInformation SET [Description] = REPLACE([Description],',','') GO
SELECT [Description], LEN([Description]) FROM ItemInformation GO
SELECT REPLACE([Description],',','') FROM ItemInformation
SELECT REPLACE([Description],'C','') FROM ItemInformation
SELECT CHARINDEX(',',[Description]) FROM ItemInformation GO
INSERT INTO ItemInformation([Description]) SELECT 'CHOCOLATE, CHIP‚' UNION ALL SELECT 'CHOCOLATE, CHIP‚' UNION ALL SELECT ',CHOCOLATE, CHIP‚' UNION ALL SELECT ',CHOCOLATE, CHIP‚ ' UNION ALL SELECT ',CHOCOLATE, CHIP‚ A' UNION ALL SELECT ',CHOCOLATE, CHIP‚ , ' GO
SELECT REPLACE([Description],',','') FROM ItemInformation GO
Currently - our Reporting Services site is setup so that all Domain Users can access it. We are starting to use Report Builder now. I have enabled the My Reports folder feature that that creates a user folder for anyone that logs onto the site. Is there a way to just create the user folders for certain people?
I just installed SQLExpress, with reporting services on my own laptop
However, when I go to http://localhost/Reports/, I can see my reports uploaded, but the subscription links are not available. In Properties, I cannot see "Execution" either.
Can someone help me to get the Subscriptions feature enable again?
We desperately require the RetainSameConnection to be set to True on our ADO.NET - ODBC connection manager. Unfortunately RetainSameConnection always defaults back to False when you open the package.
* Is RetainSameConnection supposed to work for the ADO.NET - ODBC combination?
* Is it a bug that it defaults back to false for the ADO.NET - ODBC combination?
Hi! I am having a terrible time with the report feature. First of all, my queries through it do not match my queries thru SQL server 2005 Express Management. When I enter my fields, through the auto query function, it moves them. When I try to put them where I think they belong (by editing the SQL code, my queries get all messed up).
Is there a way to import my SQL query and run it through the report feature?
I am using windows XP Pro Microsoft Visual Studio 2005 version 8.0.50727.42 Microsoft SQL Server Reporting Services Designers version 9.00.2047.00
Is it possible to set up a one to one relationship between two tables, where one side of the relationship is optional? For example, I have two tables "Applicant", and "Client":A client will always have one applicant
I need to use a parameter in a stored procedure that is optional and if it is optional I need all records returned, even if there is an entry in the field that the parameter is appllied to. Is this possible? I know I can assign a default value. but the value in the field could be one of many choices. I want to be able to specify a choice and have only those records returned or leave it blank and return all records.
I've been away for a while but now that I'm back one if the first things I noticed is how many of the problems on this forum could have been easily avoided by simply normalizing the database in question.
For those of you without formal SQL training, know this: You have to normalize your database. This is part of the process of database development. You can not just whack together a few tables in whatever way is the easiest for the problem at hand, because eventually your requirements will expand and then you need your data to be flexible.
Seriously, in the last 3 weeks I've seen many many questions where it is obvious that the problem is a flawed DB design, but all the so-called SQL gurus here will just answer the question without addressing the fact that the problem lies much deeper.
Here's a link I found on Google: http://www.cse.unsw.edu.au/~cs3710/PMmaterials/Tutorials/normalise.htm
I have a web page I want to run a stored procedure from. In the web page I have three drop downs Business Area, Business Unit and Reporting PeriodThe drop downs determine whether all projects are returned or all projects for a certain business unit / business area or month.This means I have to tailor my sql statement accordingly. What I want to know is can I append sections of a sql statement ie add or subtract more where clauses depending on the values pulled in from the web page.At the moment I have only accounted for 2 variables and that has caused me to create 4 IF statements depending on the values. 3 variables would cause even more IF statements and multiple combinations which I am trying to avoid.
Hello guys, I want to implement a searching with a stored procedure. As an example I have a table like > tableA ; Id,Name,Surname,Gender(bit) 0 -Male , 1 - Female
If i want to choose all records that are male, I could simply have a query like this : SELECT * FROM tableA WHERE Gender = 0 and vice versa for female. If i want to choose all rows in the table i should omit where clause. The problem is , when i use a stored procedure i should send a parameter. And i dont know if there is a possible way to to do this. When i try such procedure : CREATE astoredprc (@gender bit) AS SELECT * FROM tableA WHERE Gender = @Gender GO -- In such prc. i can only get rows with a where clause. What if i want to use the same procedure with all rows and omiting where. I have many fields like this and I m unsure if I should use a text query or not ... Thanks for all of u from now on
I want the procedure to process 1) all data is no dates are presented 2) all data after the start date, if no end date is supplied 3) all data before the end date if no start date is supplied 4) all data between the start and end dates if both are supplied
Now, instead of an elaborate conditional, I added this to the WHERE clause of my SQL statement:
AND ((@start_date IS NULL OR service_date >= @start_date) AND (@end_date IS NULL OR service_date <= @end_date))
It works fine, but I want to know if anyone has a different/better way of doing it, or if there is a big bug waiting to happen here.
I typically don't like to create multipurpose routines in my code, but this is a better approach for my in a non-object-oriented world of SQL.
Hi, I wish to create a user defined funtion in sqlserver2005 with optional parameter list. So at the time of function calling the parameters should be a optional one. How can i do this? please help me .