OLE DB Command Stage: Capturing Rejects
May 2, 2007
Hello group, I have a question regarding the OLE DB Command Stage. Currently, I am reviewing a Data Flow that runs in production. This Data Flow Inserts to the various dimension tables in our warehouse. For a particular dimension table, the flow is like this:
Read Source records for Product combinations
LookUp Product combinations against the current dimProduct table (cached in memory)
Rows not found are then subjected to another LookUp on the dimProduct table (not cached). This is to find any rows inserted during the current run
Rows not found are then Inserted to dimProduct using a Stored Procedure invoked by an OLE DB Command
Successful Inserts then continue on, Rejected Inserts should be captured to a Flat File on our server for review.
Apparently, this last step has never been successful at capturing Rejects. Obviously, we would want to review these records to find the reason for failure. We get an empty file.
Currently, in the Stored Procedure we are using logic like this:
IF @PRODUCTCOUNT <> 0
BEGIN
RAISERROR ('DUPLICATE PRODUCT!', 10, 1)
RETURN
END
Questions:
Is the RAISERROR command going to give us Output?
Can we implement the OUTPUT command in our Proc invocation?
I have not found any documentation that says the OLE DB Command Stage supports Error logging (Although columns are available to be added in the Input/Output columns tab??)
Should we be using another Stage to accomplish this?
Any thoughts are welcome, thanks for your time!
rg
IF @PRODUCTCOUNT <> 0
BEGIN
RAISERROR ('DUPLICATE PRODUCT!', 10, 1)
RETURN
END
View 3 Replies
ADVERTISEMENT
Jul 13, 2006
I have created a sample dataflow to parse the employee details (empid,empname,empaddr) from a flat file to oracle 9i database table named employee(columns : empid,empname,empaddress - All are varchar2(15)) using SLOWLY CHANGING DIMENSION transformation for insert/update on the table.
EMPID as Businees key
EMPNAME and EMPADDR as changing attributes.
Connection string is using Microsoft oledb provider for oracle.
I am getting the following oledb command error.
-----------------------------------------------------------------------------------
TITLE: Microsoft Visual Studio
------------------------------
Error at Data Flow Task [OLE DB Command 1 [2007]]: An OLE DB error has occurred. Error code: 0x80040E51.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80040E51 Description: "Provider cannot derive parameter information and SetParameterInfo has not been called.".
Error at Data Flow Task [OLE DB Command 1 [2007]]: Unable to retrieve destination column descriptions from the parameters of the SQL command.
Warning at {CF5DCB64-279E-45A4-A9A8-FF2FBB130980} [Insert Destination [1972]]: Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used.
------------------------------
ADDITIONAL INFORMATION:
Errors were encountered while generating the wizard results:
Error at Data Flow Task [OLE DB Command [1996]]: An OLE DB error has occurred. Error code: 0x80040E51.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80040E51 Description: "Provider cannot derive parameter information and SetParameterInfo has not been called.".
Error at Data Flow Task [OLE DB Command [1996]]: Unable to retrieve destination column descriptions from the parameters of the SQL command.
Error at Data Flow Task [OLE DB Command 1 [2007]]: An OLE DB error has occurred. Error code: 0x80040E51.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80040E51 Description: "Provider cannot derive parameter information and SetParameterInfo has not been called.".
Error at Data Flow Task [OLE DB Command 1 [2007]]: Unable to retrieve destination column descriptions from the parameters of the SQL command.
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2005&ProdVer=8.0.50727.42&EvtSrc=Microsoft.DataTransformationServices.Design.SR&EvtID=ScdWizardGenerationErrors&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
View 4 Replies
View Related
Apr 21, 2006
Hi,
I'm writing a small query where I have a dynamic table name and dynamic condition for the criteria. In order to execute this, I need Exec command.
exec(select count(*) from @dynamictable where condition = @dynamiccond)
But here I want to capture the count from the select statement. Could any of you help me capture the results from exec command?
Thanks
View 6 Replies
View Related
Jun 14, 2002
I used the following command to import a text file:
exec master..xp_cmdshell 'bcp t-est.dbo.test in c:est.csv -c -t, -r -Sserver -Uuser -Ppassword'
I got the following error message:
SQLState = 37000, NativeError = 170
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '-'.
I user SQL 7 SP4.
Is that a known limitation of BCP?
Thanks in advance.
View 1 Replies
View Related
Aug 17, 2006
We're trying to use the WebServiceTask to retrieve a report from the SQL Server Reporting Services (SSRS) web service but getting a "This version of the Web Services Description Language (wsdl) is not supported." error after selecting the Service on the inputs tab. Some additional information...
- I can get other web services to work just fine.
- the SSRS web service works fine as I can download the wsdl in the task window, and we have successfully worked around this issue by creating a proxy class in .NET code and called it through the ScriptTask to get the results we need.
- I'm pretty certain the SSRS server is the 2005 version but can't confirm this.
So the problem seems to be just that SSIS can't read the wsdl created by SSRS.
As said we've worked around the problem successfully but would prefer to use the built in functionality, which should work especially to SSRS. Any help, advice would be greatly appreciated!
View 2 Replies
View Related
Sep 27, 2007
PROBLEM:
SQL 2005 rejects connection from an ASP.net test webpage (shown below).
CONFIGURATION:
Internet > Concast Cable > Router > Sever01 Nic1 > Server01 SBS 2003 & SQL 2005 > Sever01 Nic2 > Switch > Local Area
Linksys Router WRV54G( Firmware Version: 2.39.2): Port Range Forwarding TCP 1433 and UDP 1434
Small Business Server 2003 Premium (Server Name: Server01)
Two network cards: Internet Ionnection and Local Area Network
Ran: Configure E-mail And Internet Connection Wizzard
Ran: Remote Access Wizzard (disables access to Windows Firewall)
Note: Remote workplace, Outlook Web Access, Sharepoint, etc, on ports 443,444, 3389, 4125 All work remotely - so Linksys router and RRAS port settings are working.
Routing And Remote Access(RRAS) >NAT/Basic Firewall > Internet Ionnection > Services And Ports
Added TCP Incoming Port 1433, Private Address 127.0.0.1, Outgoing Port 1433
Added UDP Incoming Port 1434, Private Address 127.0.0.1, Outgoing Port 1434
SQL Server 2005 Standard Edition version 9.0.3042 (installed on same machine, default instance ID MSSQLSERVER)
By default: TCP protocol is enabled and local remote connections are enabled on standard Edition. Also by default: MSSQLSERVER automatic/started/running and SQL Server Browser automatic/started/running
Ran: SQL Server 2005 Surface Area Configuration to confirm MSSQLSERVER instance settings are running.
Using: SQL Server Authentication: Login and Password
"sa" is a default account that works locally.
SQL Server Configuration Manager:
MSSQLSERVER protocols: Share Memory and TCP/IP enabled
TCP port 1433 by default (confirmed listening by ERRORLOG)
Microsoft SQL Server Management Studio
Database Engine lists SERVER01 (instead of SERVER01MSSQLSERVER - the default instance is not named explicitly)
Created database "Test" under SERVER01 > Databases.
Created table "tblCategories" in "Test" (included some fields and data)
Server-Side Successful?
netstat -ano | findstr 1433
TCP 0.0.0.0:1433 0.0.0.0:0 LISTENING 2004
Client-Side
Ping Successful
ping <xxx.xxx.xxx.xxx>
Telnet Successful (blank screen)
telnet <xxx.xxx.xxx.xxx> <port#>
TEST ASP.net Web Page Button Sub
I have this button on a page at Godaddy.com connecting to an instance of MS SQL provided by Godaddy and there is no problem connecting to that SQL Server.
Public Sub TestSQL_Click(Sender As Object, e As EventArgs)
Dim rdr As SqlDataReader = Nothing
Dim conn As SqlConnection = new SqlConnection("Data Source=tcp:xxx.xxx.xxx.xxx; Initial Catalog=Server01 blCategories; User ID=sa; Password=xxx")
conn.Open()
Dim cmd As SqlCommand = new SqlCommand("SELECT Category FROM tblCategories;", conn)
rdr = cmd.ExecuteReader()
rdr.Close()
conn.Close()
End Sub
ERROR:
The follworing error occurs or variations of it depending on different connection string configurations:
Occurs at: conn.Open()
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
THOUGHTS
Possibly a bad connection string or Microsoft security issue.
I've attempted many other connection string formats such as:
Dim conn As SqlConnection = new SqlConnection("Data Source=xxx.xxx.xxx.xxx,1433;
Network Library=DBMSSOCN; Initial Catalog=Server01Test; User ID=sa; Password=xxx")
But I continue to receive connection failure messages (or invalid connection string errors for incorrectly formed connection strings).
I've tried disabling RRAS and Windows Firewall and the same errors resulted.
Any feedback would be appreciated.
View 29 Replies
View Related
Dec 13, 2007
SQL Database in my application with windows authentication rejects accessing after deploying and remote access
1- My web applications databese access is windows authentication
2- In developing area there is no problem for accessing database
3- After deploying to another server there is problem accessing database:
Cannot open user default database. Login failed.Login failed for user 'BRCK231ASPNET'.
How can I solve this problem?
Thanks.
View 1 Replies
View Related
Mar 15, 2002
Hello,
I did not know how to search the archives here yet, so sorry if this is a repeat question.
I am installing SQL Server 2000 Developer edition on my XP Pro workstation and it is failing at the stage of the setup where it attempts to configure the database and run scripts.
sqlstp.log give me this error set:
Starting Service ...
SQL_Latin1_General_CP1_CI_AS
-m -Q -T4022 -T3659
Connecting to Server ...
driver={sql server};server=KGB;UID=sa;PWD=;database=master
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()).
driver={sql server};server=KGB;UID=sa;PWD=;database=master
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()).
driver={sql server};server=KGB;UID=sa;PWD=;database=master
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()).
SQL Server configuration failed.
################################################## #############################
17:13:42 Process Exit Code: (-1)
17:13:46 Setup failed to configure the server. Refer to the server error logs and C:WINDOWSsqlstp.log for more information.
17:13:46 Action CleanUpInstall:
17:13:46 C:WINDOWSTEMPSqlSetupBinscm.exe -Silent 1 -Action 4 -Service SQLSERVERAGENT
17:13:46 Process Exit Code: (1060) The specified service does not exist as an installed service.
17:13:46 C:WINDOWSTEMPSqlSetupBinscm.exe -Silent 1 -Action 4 -Service MSSQLSERVER
17:13:46 Process Exit Code: (0)
17:13:46 StatsGenerate returned: 2
17:13:46 StatsGenerate (0x0,0x1,0xf000000,0x0,1033,303,0x0,0x1,0,0,0
17:13:46 StatsGenerate -1,kgood)
17:13:46 Installation Failed.
Any help would be appreciated.
Thanks.
Kel
View 2 Replies
View Related
Aug 18, 2006
Hi ,
Can any one give a summary of difference between Data Stage and SSIS . we are in process of Migrating existing Jobs in Data Stage to SSIS .so i am prepareing a comparitive report between Data Stage and SSIS . help us pls
Jegan
View 1 Replies
View Related
Apr 30, 2015
I want to create an import table for daily rows with an integer column like 20150430 for the date, called DayKey. This table would do one date per day. It would then be imported into a STAGE table which would have the same columns and would have all of the import rows for every day.My question would be this: I want to be able to have an integer Primary Key unless there is a better idea. I could make the STAGE table use an auto-incremented value for the key. Then, when I load the import table which is truncated every day, I could take the NEXT value of the key from the STAGE table and increment by 1.
Let's say the last value in STAGE is 1000, then the next value that would be in IMPORT would be 1001 and incrementing up. Then these would be added to the STAGE table with the associated keys. There is no chance of anyone or anything else adding to the STAGE table any other way.
View 3 Replies
View Related
Jan 1, 2008
How do I tell the destination of the dataflow to use the stage table that has not been created yet?
View 9 Replies
View Related
Apr 21, 2015
Can i have a combination of sources some with Unique Identifiers and some without?
I need to know what happens when I have option “Create Code values automatically” selected for the entity and same time pulling Unique Identifier for other sources in same entity stage table.
When we select option “Create Code values automatically” for the entity we creates, then during load from external source to MDM stage we don’t send any values to MDM stage “Code” field and in next step when we execute the stored procedure to load the data from MDM stage to MDM model, it assigns the Code values to each record in MDM stage and MDM model.
I need to know whether after executing the store procedure, will it assign Code values for only NULL records in MDM stage and not give us any error for the records that already have Code values present in MDM stage.
View 3 Replies
View Related
Apr 13, 2015
I am new to MDM profisee tool and currently working for Addres verification project for my organization.I wanted to clear my doubts here about Unique Identifer in Stage table and how it works.. Here what i understand till now:
Step 1) I created an Entity using MDM profisee UI and it generated a stage table in MDS database called stg.Address_leaf
Step 2) I have loaded data from external source to MDS stage table using ETL and passed Import type as 2 and Import status id as 0
Step 3) I have run store procudure system generated something stg.udp_Address_leaf to load the model and passed the version name as Version_1, Log flag as '1' and Batch tag as 'Address'
Now my below are my questions:
1) What is the field i can use in MDS stage table to populate my unique intifier value coming from source? (lets say Address_Id is my Unique value for all the records coming from source)
2) Where/how Unique Identifier is useful in this process? Will this be useful in next time load from stage to Model?
3) If i truncate and load my MDS stage table in next run and few earlier records has been updated how it will update those records in Model? will this process (code present in SP) recognize by Unique Identier column present in MDS stage table?
View 3 Replies
View Related
Sep 26, 2005
I need to first capture the max version associated with a file name here is the meat
SELECT
fileName,
f.folderName,
masterID,
iterationId,
iterationNumber version
FROM
fileIteration fi
JOIN iteration i on (i.iterationID = fi.fileIterationID)
JOIN vw_folderFileLink fl on (fl.fileMasterID = i.masterID)
JOIN folder f on (f.folderID = fl.folderID)
WHERE
fileName LIKE '429020652.idw'
--GROUP BY masterID, fi.FileName, f.FolderName, fileName, i.iterationID
ORDER BY masterID, version DESC
--*******end code ********--
that returns these results:
429020652.idwSubPumps71575217
429020652.idwSubPumps71575116
429020652.idwSubPumps71574975
429020652.idwSubPumps71574654
429020652.idwSubPumps71573983
429020652.idwSubPumps71573142
429020652.idwSubPumps71573131
First I need help just getting that top row but then I need to get all expect the top row selected.. I've tryed using MAX in several ways but I'm not getting what i want here :/ any help is appreciated
View 5 Replies
View Related
Apr 22, 2015
I am getting ErrorCode 8 while loading the data from stage to model. I have checked my error view it states that "Member Code is Inactive".
Initially I have loaded same set of data in Model from MDS Stage table but then deleted with ImportType = 5 which removed all the data from the MDM model.
Now i want to load it back but its giving the Error Code 8 .. Before loading the same data i have changed the stage table Importtype to 2 and Importstatusid to 0.
View 6 Replies
View Related
Oct 25, 2015
we have a table in our ERP database and we copy data from this table into another "stage" table on a nightly basis. is there a way to dynamically alter the schema of the stage table when the source table's structure is changed? in other words, if a new column is added to the source table, i would like to add the column to the stage table during the nightly refresh.
View 4 Replies
View Related
Aug 12, 2004
Hi all,
I am new to .NET, after many years with classic ASP I am struggling a little with something that I am sure is really easy to do.
Basically what I want to do, is execute an SQL statement, that will return a single value. I then need to store this value as a variable, so that I can pass it into another query later.
It seems easy to output the record, but how do I store it as a variable !!
This is my code to connect and run the SQL... all I need to do as retreive the value, and put it aganist a variable....
Function higher_manager_ein() As System.Data.IDataReader
Dim connectionString As String = "server='myserver'; user id='userid'; password='pwd'; database='DB'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim queryString As String = "SELECT distinct MEASURE FROM [CCC_MEASURE] where ein = '" & request("man_ein2") & "'"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
dbConnection.Open
Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Return dataReader
End Function
View 2 Replies
View Related
May 22, 2000
Is there any way(other than Profiler) to capture a full SQL Query statment. I've used dbcc inputbuffer and the current activity screen, both return 255 characters. I'd like to capture the whole query. Thanks
Pete Karhatsu
View 3 Replies
View Related
Sep 20, 2004
Hi y'all....long time, I know...
I have what OUGHT to be a simple question...or so I think (which really hurts, mind you...)
I am writing a stored proc that will reside on several different databases and be used to write a row to a "wait table" that is used to control processing in the various databases...
Essentially, the stored proc already exists, and writes what is essentially a note (or process semaphore) that says "Hey, Process XYZ is waiting on the completion of process 123"
Problem is...process XYZ has the same name on a number of different servers, so I have to come up with a way to differentiate the process name that's waiting on a job on a single server (in other words, 5 or more XYZ's can be waiting on a single job on a single server in the network, and the wait table resides on that single server).
So...my thought (again, think pain) is that I will put a process name of "SERVER.XYZ" into the wait table.
The SP I will use to write the "waiting on" semaphore is a common one, so - long story short(er) I need a way to capture the name of the current server (like db_name(), only server_name() - or something like it).
Any suggestions? Thanks in advance...
Paul
View 5 Replies
View Related
Jun 3, 2008
Hi
Please let me know which DMV is best to cpature total system CPU utilization. There are plenty of views so i am a lil bit confused
thanks in advance,
View 3 Replies
View Related
Jan 2, 2008
I have a bit of code that executes an INSERT statement to add a record to an existing table. This table of course has an automatically incrementing ID field, and I'd like to somehow have my INSERT statement return the value of that ID field so that I can automatically show the user the record they've added.
Is there a clean way to do this?
View 4 Replies
View Related
Jul 20, 2005
This doesn't work because the first INSERT is creating multiplerecords for multiple projects. @@IDENTITY, then, contains the Identitycolumn value for the last tblWeekReportedLine record inserted.Consequently, all the hours records are then associated withthat last value.The source work table, #EstimateLines, is a pivoted representationwith a Begin/End date and some Hours for each of six periods - a lineper project that gets pushed up to the DB by some VB code.Definition below the sample coding.The "@WeekReportedID" value was successfully captured whenprevious coding inserted six records into that table: one foreach date range (i.e. column in the UI screen)Sounds like I'm approaching this wrong.Suggestions on the right way to go about it?---------------------INSERT INTO tblWeekReportedLine(WeekReportedID,RelativeLineNumber,ProjectID)SELECT@WeekReportedID1,#EstimateLines.RelativeLineNumber,#EstimateLines.ProjectIDFROM#EstimateLines;SET@CurWeekReportedLineID = @@IDENTITY;INSERT INTO tblHour(WeekReportedID,WeekReportedLineID,HoursDate,Hours,HoursTypeID,HoursType,TaxCodeID,TaxCode)SELECT@WeekReportedID1,@CurWeekReportedLineID,@BeginDate1,Estimate1,@DummyHoursTypeID,@DummyHoursType,@DummyTaxCodeID,@DummyTaxCodeFROM#EstimateLines;------------------------The #Temp table create via VB:------------------------1030 .CommandText = "CREATE TABLE #EstimateLines " & _" ( " & _" PersonID int, " & _" ProjectID int, " & _" RelativeLineNumber int, " & _" Available1 decimal(5,2) Default 0, Estimate1decimal(5,2) Default 0, BeginDate1 DateTime, EndDate1 DateTime, " & _" Available2 decimal(5,2) Default 0, Estimate2decimal(5,2) Default 0, BeginDate2 DateTime, EndDate2 DateTime, " & _" Available3 decimal(5,2) Default 0, Estimate3decimal(5,2) Default 0, BeginDate3 DateTime, EndDate3 DateTime, " & _" Available4 decimal(5,2) Default 0, Estimate4decimal(5,2) Default 0, BeginDate4 DateTime, EndDate4 DateTime, " & _" Available5 decimal(5,2) Default 0, Estimate5decimal(5,2) Default 0, BeginDate5 DateTime, EndDate5 DateTime, " & _" Available6 decimal(5,2) Default 0, Estimate6decimal(5,2) Default 0, BeginDate6 DateTime, EndDate6 DateTime, " & _" );"--------------------------PeteCresswell
View 2 Replies
View Related
Jul 20, 2005
I'm trying to add functionality to a VB 6 application allowingcustomer service to add a customer number to a new customer.Customers are added to the database by sales personnel, and aprospective customer may have multiple rows due to projected ordersfor multiple products. Customer numbers are assigned when a newcustomer makes their first order.I'm using a DataGrid connected to an ADO Data Control. The datacontrol is connected to a view in SQL Server using the 'distinct'directive (I know it's not updatable) to show only one line per newcustomer. What I wish to do is capture the update event (probablythrough the FieldChangeComplete routine of the data control), manuallyassign the newly entered customer number to all appropriate rows inthe database, and cancel the update event with no notifications.I'm having two problems:1. I can't capture the newly entered customer number. The Textproperty of the DataGrid returns the old value of the cell instead ofthe newly entered value. How do I get the edited value?2. Even though I set adStatus = adStatusCancel in theFieldChangeComplete routine, I get a Microsoft DataGrid Control dialogstating 'Operation was Canceled'. How do I avoid this notification?
View 1 Replies
View Related
Nov 13, 2006
Hi All
When running an SSIS Package from BIDS, we get to see the "Progress" tab which explains us the progress of the SSIS Package. During production, is there any way to capture this log. I am interested in using this as a log file for each run of my SSIS package.
Thanks,
S Suresh
View 9 Replies
View Related
Dec 19, 2007
[Microsoft follow-up]
I've just been reading this thread by a guy asking about capturing the throughput of a dataflow. I suggested that there is no real notion of capturing throughput of a dataflow but I believe there IS a notion of capturing the throughput of a component or an execution tree.
I believe all the information that one would need to capture the throughput of a component (apart from the name of the component that is) is available in the OnPipelineRowsSent event. If there were a OnPipelineRowsSent eventhandler and the OnPipelineRowsSent event contained the name of the component then I think we would be able to capture the throughput of a component. So, some questions:
Why is there no eventhandler for the OnPipelineRowsSent event?
Can the name of the component be added to the information in the OnPipelineRowsSent event?
Following on from this... I once had a conversation here with Kirk Haselden about capturing pipeline throughput. He thought it was a good idea and suggested I raised a DCR for it which I did but that was in the old pre-Connect days and it seems as though that DCR (like SO many other things) didn't make it across to Connect. So, some more questions:
Can you find any Connect DCRs relating to capturing throughput? I've found this: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=152162 that I raised 18 months ago but which hasn't even had a single comment from anyone at Microsoft.
Do you think that capturing throughput would be useful? I can foresee huge advantages by capturing this in the debugger. (Note that Informatica does this and has done for years. It has a very nice GUI that shows the throughput of each destination in the mapplet.)
I'd welcome any thoughts around this. Its a big ask and it fits in very nicely with my constant, nay INCESSENT, requests for debugging enhancements so maybe this is one for Darvey to have a read of???
Thanks
Jamie
View 16 Replies
View Related
Nov 30, 2007
My question is this.....
I inherited an application that creates reports and each report pulls data from a SQL database. The reports are for each School district in the state and pull the number of students that have Asthma conditions, simple enough. However what happens is this... Each initial report is saved with a code of 2 for initial. As long as there aren't and revisions I am fine. If a school makes a revision (Code of 4) I now have two records in the database and I need the one from the revision (Code 4). Not every record will have a revision, and sometimes there may be multiple revisions. How can I code my stored procedure to go through the database and check to see if there is a code of 4 or multiple codes of 4 and if so grab that data, if not grab the initial data? Below is the code currently being used. Frank
CREATE PROCEDURE dbo.usp_Rpt_Asthma
(@WhereClause VARCHAR(400))
AS
SET NOCOUNT ON
DECLARE @WhereClause_STR VARCHAR(400)
SELECT @WhereClause_STR = CONVERT(VARCHAR(400),@WhereClause)
Exec ('Select D.Code, C.Code, InstCtgyFK, C.[Description] as County, D.DistrictName, A.InstName,
Sum(K4+K+G1+G2+G3+G4+G5+G6+G7+G8+G9+G10+G11+G12+UnGrSpEd+Other) as TotalADM, Asthma, Asthmatics
FROM dbo.tblAnnualReports AR
Inner Join dbo.tblAddresses A on A.InstitutionFK = AR.InstitutionFK
Inner Join [DHHBGSQLPROD1].[Shared Common Data].[dbo].[tblInstitution] I on A.InstitutionFK = InstitutionPK
Inner Join [DHHBGSQLPROD1].[Shared Common Data].[dbo].[tblActiveInstCtgy] AIC on A.InstitutionFK = AIC.InstitutionFK
Inner Join [DHHBGSQLPROD1].[Shared Common Data].[dbo].[tblCounties (PA Standard)] C on C.Code = I.DOHCountyCode
Inner Join [DHHBGSQLPROD1].[Shared Common Data].[dbo].[tblCommunityHealthDistricts] D on D.Code = C.CommunityHealthDistrictCode
Inner Join dbo.tblAverageDailyMemberships ADM on AR.[ID] = ADM.AnnualReportID
Inner Join dbo.tblChronicConditionsInjuries CC on AR.[ID] = CC.AnnualReportID
Inner Join dbo.tblMedicationAdministration MA on AR.[ID] = MA.AnnualReportID
Where (A.StartDate <= AR.DOHDateProcessed and (A.EndDate >= AR.DOHDateProcessed or A.EndDate is Null or A.EndDate = ''1/1/1900''))
and ReportTypeCode = 2
and IndOrdStandOrd = ''I''
'
+ @WhereClause_STR +
'
Group By D.Code, C.Code, InstCtgyFK, C.[Description], D.DistrictName, A.InstName,
Asthma, Asthmatics
')
GO
View 15 Replies
View Related
Aug 31, 2007
I'm creating a sproc to to count the dates and times users log on to a page. I want the date and time broken out into two columns.
When I attempt create the sproc I get the following error:
Subqueries are not allowed in this context. Only scalar expressions are allowed.Create PROCEDURE [dbo].[LoginCounter]
@Username Nvarchar(50),
@IPAddress Nvarchar(50),
@BuilderID, INT
As
INSERT INTO LoginCount ([UserName], [IPAddress], [Date], [Time], [BuilderID])
VALUES (@Username, @IPAddress,
(SELECT CONVERT(VarChar(2), MONTH(GETDATE()))+ '/'+ CONVERT(VarChar(2), DAY(GETDATE()))+ '/'+ CONVERT(VarChar(4), YEAR(GETDATE()))),
(SELECT Convert (varchar (2), DATEPART(hour, GETDATE())+ 3) +':'+ CONVERT(VarChar(2), DATEPART(minute, GETDATE()))),
@BuilderID)
View 3 Replies
View Related
Sep 15, 2003
Hello.
I would like to analyze how a particular 3rd party business application interacts with SQL server.
Specifically, I want to capture the "exact" SQL commands (transact-sql statements) that this application issues whenever it completes an operation for the user of this application.
In other words, suppose the application issues the SQL command "INSERT INTO table (a,b,c) values (1,2,3)" to add a new entry to the database. Then, my understanding is that if I instead issue the exact same command with a tool like "SQL query analyzer", the database will be updated in the exact same manner. Hence, I have effectively accomplished the same job that the 3rd party application does without even using it (by idependantly issuing the same command to the database it uses).
Is this possible? Can I obtain all the information I need just by running SQL Profiler?
View 3 Replies
View Related
May 26, 2004
Hi,
Can someone help me out with capturing the bulk insert error.I have a job which calls a procedure in which I used the bulk insert command .If the bulk insert is failing due to some reason as wrong delimitor,wrong path etc then the job fails.I need to track that error and see that the job doesnt stop and goes onto the next cursor record.
Thanks,
Nodbek
View 8 Replies
View Related
Apr 1, 2002
I'd like to capture the avg. # of user logins and # db hits per a 5 interval for a weeks time. I'm guessing there are sys tables containing this info. and by using temporary tables and/or creating/modifying SPROCS this info. can be retrieved. If I'm on the right track, a little direction would be very appreciated. If I'm not on track, please assist this rookie dba.
Thank you,
Eoin
View 2 Replies
View Related
Jun 14, 1999
I currently have a need to dynamically build an sql statement that always returns a single value when executed. The sql statement is always the same except the database name reference in the statment.
What I need is to be able to capture that value for later use in the procedure. Since this is a stored procedure, I can't use the "USE" statment to switch databases and I haven't been able to figure this out using the Execute statement. I can execute the string, but I can't capture the value.
I'm simply trying to execute the same set of sql statements in a stored procedure without hardcoding database names or build an identical stored procedure in all our databases.
Any help is appreciated.
View 2 Replies
View Related
Nov 25, 1998
Can I declare variable and assign a user defined table name in Sql server 6.5. if so how can I do that ,
Thanks
Ali
View 1 Replies
View Related
Jul 23, 2004
Hey y'all...
Anyone know how to capture SQL Warnings so I can write them to an error log? I can't seem to find any info on it in Books Online...
I can capture the errors just fine by using @@ERROR after a select, but what about warnings such as "Warning: Null value is eliminated by an aggregate or other SET operation."
Thanks!
View 4 Replies
View Related