Stored Procedure Works Fine, But Doesnt Preview? (Beginner)
I modified this stored procedure with the code highlighted, and now it runs forever on reporting services. Can anyone tell me what might be causing this? Here's my code. When i run it in Management studio and the dataset in reporting services, it works fine. But when it comes to previewing it, it runs forever.
USE [RC_STAT]
GO
/****** Object: StoredProcedure [dbo].[PROC_RPT_EXPENSE_DETAIL_DRILLDOWN] Script Date: 06/29/2007 11:34:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[PROC_RPT_EXPENSE_DETAIL_DRILLDOWN]
(@Region int = Null)
AS
BEGIN
SELECT
[Item_Ledger_Posting_Datetime] Post_Date
,'SMP' Budget_Type
,'Invoice' as Document_Type
,[Item_Ledger_Document_No] Document_Number
,[Item_Description]+' '+'('+[Item_No]+')' Entry_Description
,ISNULL(RC_STAT.dbo.udf_Correct_Price(Item_No, Item_Ledger_Posting_Datetime, 'SALESAMP') * -1*Item_Ledger_Invoiced_Qty,Item_Ledger_Cost_Posted_GL * -1 ) Amount
,-1*[Item_Ledger_Invoiced_Qty] Quantity
,Customer_Name
,'' External_Doc_no
,[Item_Ledger_Sales_Responsible] SR_Code
,[Item_Ledger_Mars_Period_Code] ThePeriod
,[Item_Ledger_Mars_Year] TheYear
,Territory.Name AS Territory_Name
,Region.Region AS Region_Name
,Budget_Reporting.Budget_Reporting_Group_ID
,Budget_Reporting_Group.Budget_Reporting_Group_Description
FROM [NavisionReplication].[dbo].[Qry_Item_Ledger_Detail]
INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser
ON [Item_Ledger_Sales_Responsible] = Salesperson_Purchaser.SalesPerson_Purchaser_Code
INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory
ON Territory.Code = Salesperson_Purchaser.Territory_Code
INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting As Budget_Reporting
ON Budget_Reporting.Salesperson_Purchaser_Code = Salesperson_Purchaser.Salesperson_Purchaser_Code
LEFT OUTER JOIN RC_DWDB_INSTANCE_1.dbo.Region AS Region
ON Territory.Region_Key = Region.Region_Key
INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting_Group As Budget_Reporting_Group
ON Budget_Reporting_Group.Budget_reporting_Group_ID = Budget_Reporting.Budget_Reporting_Group_ID
WHERE Region.Region_Key = @Region
AND [Item_Ledger_Mars_Year] = 2007
AND [Item_Ledger_Amount]= 0
UNION ALL
SELECT
[GL_Entry_Posting_DateTime]
,Budget_Reporting.[Budget_Type_Code]
,[Document_Type]
,[GL_Entry_Document_No]
,[GL_Entry_Description]
,[GL_Entry_Amount]
,0 Quantity
,[User_ID]
,[GL_Entry_External_Document_No]
,[Sales_Responsible]
,[Mars_Period_Code]
,[Mars_Year]
,Territory.Name AS Territory_Name
,Region.Region AS Region_Name
,Budget_Reporting.Budget_Reporting_Group_ID
,Budget_Reporting_Group.Budget_Reporting_Group_Description
FROM [NavisionReplication].[dbo].[Tbl_GL_entry] GL_entry
INNER JOIN [RC_DWDB_INSTANCE_1].[dbo].[Tbl_Budget_Accounts] Budget_Accounts
ON Budget_Accounts.[GL_Account_No] = GL_entry.[GL_Account]
INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser
ON GL_entry.[Sales_Responsible] = Salesperson_Purchaser.SalesPerson_Purchaser_Code
INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory
ON Territory.Code = Salesperson_Purchaser.Territory_Code
LEFT OUTER JOIN RC_DWDB_INSTANCE_1.dbo.Region AS Region
ON Territory.Region_Key = Region.Region_Key
INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting As Budget_Reporting
ON Budget_Reporting.Salesperson_Purchaser_Code = Salesperson_Purchaser.Salesperson_Purchaser_Code
INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting_Group As Budget_Reporting_Group
ON Budget_Reporting_Group.Budget_reporting_Group_ID = Budget_Reporting.Budget_Reporting_Group_ID
WHERE GL_entry.[Mars_Year] = 2007
END
View Complete Forum Thread with Replies
Related Forum Messages:
- Report - Preview Looks Fine, But Exporting To PDF Splits Controls!!!Help!!
- Stored Procedure Sort Parameter Doesnt Work
- Beginner Question, Stored Procedure
- Easy Stored Procedure Question (beginner)
- Sql Job Fails But When Run Outside Works Fine
- Color Property Works In Preview But Not In Deployed Report
- Conditional IIF On Color Property Works In Preview But Not When Deployed
- Report Works In Preview Mode But Not In SSMS 2005
- Transfer Problems For 6.5 Next Week Works Fine
- 32 Bit DTExec Fails While 64 Bit Works Fine On 64 Bit Machine
- Job Doesn't Work But Package Works Fine
- Conditional Formatting Of Color Property Works In Preview But Not When Deployed
- Setting ReportViewer URI And Path In Designer Works, C# Doesnt Work
- SSRS 2005 Conditional IIF On Color Property Works In Preview But Not When Deployed
-
Remote Connection Tests Fine, But Nothing Works On The Page Itself.
-
DTS Job Failing Execution When Scheduled, Works Fine Manually.
- Query Works Fine Outside Union, But Doesn't Work .. .
- Using Symmetric Key Problem With Encryption, Decryption Works Fine
- Slow Query....drop Index Works Fine!!!!!
- Report Works Fine Stand Alone, But Fails When Used As Subreport
- Multivalue Works Fine In The Sproc But Not In Bids Or Reportserver
-
Problems Publishing My Personal Website - Works Fine Locally!
- Long Running Query In SQL 2005 But Works Fine In SQL 2000
- Works Fine In Designer But When I Load The Report It Doesn't Work
- Permission Issue With Tempdb Works Fine In SQL2000 But Not SQL2005
-
Stored Procedure Works Only Once.
-
Havin Trouble Inserting Records To A Table.. Update Works Fine
- Works Fine Inside BI Dev. Studio, But Fails When Scheduling It In SQL Server 2005.
-
Stored Procedure Works But Nothing Returned?
- SQL 2000 Partitioned View Works Fine, But CURSOR With FOR UPDATE Fails To Declare
- Table Visibility Not Functioning Correctly On Server, Works Fine In Visual Studio
- Stored Procedure Only Works In When App Uses Trusted Security
- Stored Procedure Works, Agent Job Aborts
- Xp_sendmail: Failed With Mail Error 0x80040111 It Works Fine When You Do A Test From Enterprise Manager
- Stored Procedure Works In Dataset Editor, But Not In Report
- Cursor Works In Query Analyzer But Not In Stored Procedure
- RESTORE FILELIST Is Terminating Abnormally Error When Running A DTS Package In SQL 2005. Works Fine In SQL 2000
-
Beginner Question: What Is The &"SELECT&" Here For? - In Stored Procedure
- Problem With Link Server From Sql 2005 To Sql 2005 - Openquery Doesnt Works
- OR Works Fine, When I Add AND Things Go Wrong (was &"Help With Simple Query&")
- Sql Report Works Fine On Internal Servers - Hosed On External Servers - Need Some Help
- Stored Procedure Works But Very Slow (was &"Optimization&")
- MS Access Back-end Works Fine, But SQL Server Back End NOT Working For Access Project
- Need Help With Stored Proc (Beginner)
- Preview Vs. Print Preview
- IsNull() Works In Query But Not In Stored Procedur
- Calling A Stored Procedure From ADO.NET 2.0-VB 2005 Express: Working With SELECT Statements In The Stored Procedure-4 Errors?
- Dtsrun Works From Command Line, Not From Stored Proc
- Extended Stored Proc Works On WIn32 Machine But Not X64
Report - Preview Looks Fine, But Exporting To PDF Splits Controls!!!Help!!
Hi, I've build correctly my report using the most efficient tools. I've made the preview and it worked just fine!However, when I export to PDF, it splits the report heigth into two pages, having the columns of my table and other controls splitted. I'm already using the font size as 7 or 8 (depends), really small, I've tried hard to reduce their size, however the result remains the same...no resolution!! Is there anybody who may have or had this situation?Any guests or help?Thanks a lot!
View Replies !
Stored Procedure Sort Parameter Doesnt Work
Hello, I am trying to make this. CREATE PROCEDURE [dbo].[P_SEL_ALLPERSONAS] @nmpersona int, @sortorder varchar(20) AS BEGIN select nmpersona, dsprimernombre, dssegundonombre, dsprimerapellido, dssegundoapellido from personas order by @sortorder END But I got this error. Please help Msg 1008, Level 16, State 1, Procedure P_SEL_ALLPERSONAS, Line 13 The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.
View Replies !
Beginner Question, Stored Procedure
Hello,I have 2 tables: Employees(EmployeeID, FirstName, LastName),EmployeeApplication(CreatedByID, EmployeeID,Date1, Date2, Content...)I need to create stored procedure that will return employee First andLast names (plus some other columns) instead *both* ID's inEmployeeApplication.I know how to do it with only one - I am using simple join, but withtwo I have no idea...Can anyone help me ?Richard...
View Replies !
Easy Stored Procedure Question (beginner)
ok. I have to seperate stored procedures. and im tryin to figure out how i can use some of fields from the tables of one stored procedure to the other. Basically i want to put them both together. Or just add a couple Fields from one to the other. But i dont know how to do it. Here is the code for the main one. SE [RC_STAT] GO /****** Object: StoredProcedure [dbo].[PROC_RPT_VET_EXPENSE_COPY] Script Date: 06/20/2007 15:34:46 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[PROC_RPT_VET_EXPENSE_COPY] (@Region int = Null, @Territory varchar(10) = Null) AS BEGIN IF @Region IS NULL AND @Territory IS Null BEGIN SELECT Item_Description , Budget_Reporting_Group.Budget_Reporting_Group_Description , Budget_Type.Budget_Type_Code, Budget_Type.Budget_Type_Description , Budget_Reporting.Budget_Forecast_Period, Salesperson_Purchaser.SalesPerson_Purchaser_Code , Salesperson_Purchaser.SalesPerson_Purchaser_Description , CASE WHEN Budget_Reporting_Group.Budget_Reporting_Group_Id = 1 THEN Budget_Reporting_Amount ELSE - 1 * Budget_Reporting_Amount END AS Amount , Salesperson_Purchaser.Territory_Code ,Territory.Name AS Territory_Name ,Region.Region AS Region_Name , Budget_Reporting_Group.Budget_Reporting_Group_Id FROM RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting AS Budget_Reporting INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting_Group AS Budget_Reporting_Group ON Budget_Reporting_Group.Budget_Reporting_Group_Id = Budget_Reporting.Budget_Reporting_Group_Id INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Type AS Budget_Type ON Budget_Reporting.Budget_Type_Code = Budget_Type.Budget_Type_Code INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser ON Budget_Reporting.SalesPerson_Purchaser_Code = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory ON Territory.Code = Salesperson_Purchaser.Territory_Code LEFT OUTER JOIN RC_DWDB_INSTANCE_1.dbo.Region AS Region ON Territory.Region_Key = Region.Region_Key WHERE Budget_Reporting.Budget_Year = 2007 END IF @Region IS NOT NULL AND @Territory IS Null BEGIN SELECT Budget_Reporting_Group.Budget_Reporting_Group_Description , Budget_Type.Budget_Type_Code, Budget_Type.Budget_Type_Description , Budget_Reporting.Budget_Forecast_Period, Salesperson_Purchaser.SalesPerson_Purchaser_Code , Salesperson_Purchaser.SalesPerson_Purchaser_Description , CASE WHEN Budget_Reporting_Group.Budget_Reporting_Group_Id = 1 THEN Budget_Reporting_Amount ELSE - 1 * Budget_Reporting_Amount END AS Amount , Salesperson_Purchaser.Territory_Code ,Territory.Name AS Territory_Name ,Region.Region AS Region_Name , Budget_Reporting_Group.Budget_Reporting_Group_Id FROM RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting AS Budget_Reporting INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting_Group AS Budget_Reporting_Group ON Budget_Reporting_Group.Budget_Reporting_Group_Id = Budget_Reporting.Budget_Reporting_Group_Id INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Type AS Budget_Type ON Budget_Reporting.Budget_Type_Code = Budget_Type.Budget_Type_Code INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser ON Budget_Reporting.SalesPerson_Purchaser_Code = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory ON Territory.Code = Salesperson_Purchaser.Territory_Code LEFT OUTER JOIN RC_DWDB_INSTANCE_1.dbo.Region AS Region ON Territory.Region_Key = Region.Region_Key WHERE Region.Region_Key = @Region AND Budget_Reporting.Budget_Year = 2007 END IF @Region IS NULL AND @Territory IS NOT Null BEGIN SELECT Budget_Reporting_Group.Budget_Reporting_Group_Description , Budget_Type.Budget_Type_Code, Budget_Type.Budget_Type_Description , Budget_Reporting.Budget_Forecast_Period, Salesperson_Purchaser.SalesPerson_Purchaser_Code , Salesperson_Purchaser.SalesPerson_Purchaser_Description , CASE WHEN Budget_Reporting_Group.Budget_Reporting_Group_Id = 1 THEN Budget_Reporting_Amount ELSE - 1 * Budget_Reporting_Amount END AS Amount , Salesperson_Purchaser.Territory_Code ,Territory.Name AS Territory_Name ,Region.Region AS Region_Name , Budget_Reporting_Group.Budget_Reporting_Group_Id FROM RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting AS Budget_Reporting INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting_Group AS Budget_Reporting_Group ON Budget_Reporting_Group.Budget_Reporting_Group_Id = Budget_Reporting.Budget_Reporting_Group_Id INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Type AS Budget_Type ON Budget_Reporting.Budget_Type_Code = Budget_Type.Budget_Type_Code INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser ON Budget_Reporting.SalesPerson_Purchaser_Code = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory ON Territory.Code = Salesperson_Purchaser.Territory_Code LEFT OUTER JOIN RC_DWDB_INSTANCE_1.dbo.Region AS Region ON Territory.Region_Key = Region.Region_Key WHERE Territory.Code = @Territory AND Budget_Reporting.Budget_Year = 2007 END END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This works. Now i want to add a couple fields from this stored procedure, into the other one. USE [RC_STAT] GO /****** Object: StoredProcedure [dbo].[PROC_RPT_EXPENSE_DETAIL] Script Date: 06/20/2007 14:57:23 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[PROC_RPT_EXPENSE_DETAIL] (@Territory varchar(10),@Year int) AS BEGIN SELECT [Item_Ledger_Posting_Datetime] Post_Date ,'SMP' Budget_Type ,'Invoice' as Document_Type ,[Item_Ledger_Document_No] Document_Number ,[Item_Description]+' '+'('+[Item_No]+')' Entry_Description ,ISNULL(RC_STAT.dbo.udf_Correct_Price(Item_No, Item_Ledger_Posting_Datetime, 'SALESAMP') * -1*Item_Ledger_Invoiced_Qty,Item_Ledger_Cost_Posted_GL * -1 ) Amount ,-1*[Item_Ledger_Invoiced_Qty] Quantity ,Customer_Name ,'' External_Doc_no ,[Item_Ledger_Sales_Responsible] SR_Code ,[Item_Ledger_Mars_Period_Code] ThePeriod ,[Item_Ledger_Mars_Year] TheYear FROM [NavisionReplication].[dbo].[Qry_Item_Ledger_Detail] INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser ON [Item_Ledger_Sales_Responsible] = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory ON Territory.Code = Salesperson_Purchaser.Territory_Code WHERE Territory_Code = @Territory AND [Item_Ledger_Mars_Year] = @Year UNION ALL SELECT [GL_Entry_Posting_DateTime] ,[Budget_Type_Code] ,[Document_Type] ,[GL_Entry_Document_No] ,[GL_Entry_Description] ,[GL_Entry_Amount] ,0 Quantity ,[User_ID] ,[GL_Entry_External_Document_No] ,[Sales_Responsible] ,[Mars_Period_Code] ,[Mars_Year] FROM [NavisionReplication].[dbo].[Tbl_GL_entry] GL_entry INNER JOIN [RC_DWDB_INSTANCE_1].[dbo].[Tbl_Budget_Accounts] Budget_Accounts ON Budget_Accounts.[GL_Account_No] = GL_entry.[GL_Account] INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser ON GL_entry.[Sales_Responsible] = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory ON Territory.Code = Salesperson_Purchaser.Territory_Code WHERE Salesperson_Purchaser.Territory_Code = @Territory AND GL_entry.[Mars_Year] = @Year END I just want to add item description and amount, Can anyone help. Im sure its simple..Im just slow on this stuff.
View Replies !
Sql Job Fails But When Run Outside Works Fine
Hi.. I am stuck at a very awkward place. I have created one package which uses an oracle view as its source for data transfer the problem is when i run the package through dtexec it works fine but when i try to schedule it I get the following error Error: 2008-03-24 13:52:40.22 Code: 0xC0202009 Source: pk_BMR_FEED_oracle Connection manager "Conn_BMR" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80004005 Description: "Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation. Provider is unable to function until these components are installed.". I am able to run the package outside the sql job and also connect to the oracle. I have oracle 9i client installed on the server and sql server is 2005. Any help would really be appreciated..
View Replies !
Color Property Works In Preview But Not In Deployed Report
Hi, I'm having a problem with an IIF statement to set the Color property on a textbox in a matrix report. If the value is > 0 the Color should be Red If the value is <=0 then Color should be Blue In preview in Visual Studio 2005, all textboxes display the correct colours. However, when the report is deployed, all colors are black. It seems to ignore the formatting. Has anyone encountered similar behaviour and is there a workaround?
View Replies !
Conditional IIF On Color Property Works In Preview But Not When Deployed
Hi, I'm having a problem with an IIF statement used to set the Color property on a text box in a matrix report. Basically, if the value is greater than 0, the color should be Red If the value is less than 0, the color should be Blue The Colors are all correctly applied when you Preview the report in Visual Studio but when the report is deployed, all values are displayed in Black. It seems to ignore the formatting when deployed. Has anyone else encountered this problem and are there any workarounds? Thanks in advance
View Replies !
Report Works In Preview Mode But Not In SSMS 2005
Hi, I've created an SSRS report in Visual Studio 2005 which runs fine in the preview. I have a list of server names which when clicked on expands to a list of databases on the chosen server. When I click on a database it then queries a table of information and displays information on that database. The query is something like: SELECT * FROM MyDB.dbo.DB_info WHERE ServerName = @ServerName and DBname = @DBname This works fine in preview mode. When I run it in SQL Management Studio via the Custom Reports menu it only works when the chosen server is the one that contains MyDB. I've run a trace and can see the query being issued when I use preview mode. However, when I run it from SSMS I don't see any query being issued to the database. This seems strange as it does return data in the instance described above and if I put MyDB into single-user mode it then complains that it can't access it so it is obviously trying to communicate with the database but not showing up on the trace. I've selected all events and only put a filter on the database name. Seeing as all of the information is in the same table it seems odd that they query only works when the server name is the one where the database is held and that the query is not shown up in a trace. I'm running the report under the same credentials too. I'm completely baffled by this so I'd be very grateful if someone could explain what might be happening here. Thanks.
View Replies !
Transfer Problems For 6.5 Next Week Works Fine
I have set up transfer of database which takes 6 hrs each saturday Type--- CMDeXEC last saturday it tooks just 7 mins and showed this error and did not coplete 2004/0619 4:00:18:42-spid14-Warning OPEN OBJECTS parameter too low 2004/0619 4:00:18:45-spit14-attempt was made to free up descriptors in localdes() 2004/0619 4:00:18:45-spid14-Run sp_configure to increase parameter value 2004/0619 4:00:19:95-spid14-Warning OPEN OBJECTS parameter too low 2004/0619 4:00:19:95-spit14-attempt was made to free up descriptors in localdes() 2004/0619 4:00:19:95-spid14-Run sp_configure to increase parameter value OriginalTransfered Data Size 19000(max 28105 mb)18640(max 18640) Log Size 4000(13105 mb)4640 (max 4640) Data Physical 18.5 gb18.5 gb logPhysical 3.90 g b4.88 gb looks like my data and log size should be increased correct if yes how to do that????? if worked this week fine (6 hrs )
View Replies !
32 Bit DTExec Fails While 64 Bit Works Fine On 64 Bit Machine
Hi, I am executing a SSIS package using dtexec. 64 bit version of dtexec works fine. But when i use 32 bit version of dtexec, it fails. i have local admin rights. Following is error description. Please help. Microsoft (R) SQL Server Execute Package Utility Version 9.00.1399.06 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 9:24:30 AM Error: 2008-03-18 09:24:32.54 Code: 0xC0202009 Source: IMALCRM Connection manager "IMAL SRC" Description: An OLE DB error has occurred. Error code: 0x800703E6. An OLE DB record is available. Source: "Microsoft OLE DB Service Components" H result: 0x800703E6 Description: "Invalid access to memory location.". End Error Error: 2008-03-18 09:24:32.54 Code: 0xC020801C Source: Load Fund Detail V_FUND_DETAIL [16] Description: The AcquireConnection method call to the connection manager "IMA L SRC" failed with error code 0xC0202009. End Error Error: 2008-03-18 09:24:32.54 Code: 0xC0047017 Source: Load Fund Detail DTS.Pipeline Description: component "V_FUND_DETAIL" (16) failed validation and returned er ror code 0xC020801C. End Error Error: 2008-03-18 09:24:32.54 Code: 0xC004700C Source: Load Fund Detail DTS.Pipeline Description: One or more component failed validation. End Error Error: 2008-03-18 09:24:32.54 Code: 0xC0024107 Source: Load Fund Detail Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 9:24:30 AM Finished: 9:24:32 AM Elapsed: 2.078 seconds
View Replies !
Job Doesn't Work But Package Works Fine
hi, I have many jobs on sql 05 and all work but one. This one writes to an Access DB on the same server as SQL. The package works fine. But when executed in the context of the SQL Agent job, it fails. Jobs that write to a text file work fine. The Access DB has no password required. By the way, that job in sql 2000 worked fine. Any ideas?
View Replies !
Conditional Formatting Of Color Property Works In Preview But Not When Deployed
Hi, I have an issue when using IIF to conditionally set the Color property on a Textbox value within a matrix report. The condition is very simple: If >=0 Make it Red If<0 Make it Blue All textboxes display the correct color in preview but when you deploy the report and access it , the values are all displayed in standard black. It seems to ignore the formatting Has anyone else encountered this behaviour and if so, do you have any workarounds?
View Replies !
Setting ReportViewer URI And Path In Designer Works, C# Doesnt Work
in both vs2008 I added a ReportViewer control to my WinForm, intending to render an RS 2005 report remotely. In the design pane (Report Viewer Tasks Popup) I specify <server report>, URL http://server name/reportserver$instance name path /folder/report name and everything is fine. When I set these values in c# as reportViewer1.ProcessingMode = ProcessingMode.Remote; reportViewer1.ServerReport.ReportServerUrl = new Uri("http://server name/reportserver$instance name"); reportViewer1.ServerReport.ReportPath = "/folder/report name"; I started getting a msg saying "the source of the report definition has not been specified". If I hit refresh, the report renders. Before I started playing with the designer setting, and only had the c# stuff specified, I wouldnt even get the message, the control would appear with all RS buttons (eg page forward arrow etc) disabled. Does anybody know why the message is appearing and how to get c#'s settings to work immediately like designer settings?
View Replies !
SSRS 2005 Conditional IIF On Color Property Works In Preview But Not When Deployed
Hi, I'm having a problem with an IIF statement to set the Color property on a textbox in a matrix report. If the value is > 0 the Color should be Red If the value is <=0 then Color should be Blue When I view the report in preview in Visual Studio 2005, all textboxes display the correct colours. However, when the report is deployed, all colors are black. It seems to ignore the formatting. Has anyone encountered similar behaviour and is there a workaround? Thanks in advance
View Replies !
Remote Connection Tests Fine, But Nothing Works On The Page Itself.
If this post belongs somewhere else I appologize. I have spent several days trying to solve this problem with no luck. My site is online. Hosted at NeikoHosting. I can connect to the database remotely when adding a datacontrol. It tests fine. But when running the page it won't connect. Even if I go in and change the Web.Config connection string to a local Data Source provided to me by Neiko, it still won't work. It just won't connect. Here are the two connection strings in the Web.Config, minus my login info: Only the remote string will pass testing. Neither works on the site. <add name="yourchurchmychurchDBConnectionString" connectionString="Data Source=MSSQL2K-A;Initial Catalog=yourchurchmychurchDB;Persist Security Info=True;User ID=me;Password=pwd" providerName="System.Data.SqlClient" /> <add name="yourchurchmychurchDBConnectionString2" connectionString="Data Source=66.103.238.206;Initial Catalog=yourchurchmychurchDB;Persist Security Info=True;User ID=me;Password=pwd" providerName="System.Data.SqlClient" /> Here is the stack trace, if that helps. [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [OleDbException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.] System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +1131233 System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +53 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.OleDb.OleDbConnection.Open() +37 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.WebControls.FormView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.FormView.EnsureDataBound() +163 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +50 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041 So....... HELP!!!! Thank you!
View Replies !
DTS Job Failing Execution When Scheduled, Works Fine Manually.
My DTS Package work fine if I Execute it manually, but I need to do it automatically just after midnight. I defined my schedule and made sure the job was present in the SQL Server Agent>Jobs, but it fails and the Job History shows the following error: DTSRun: Loading... DTSRun: Executing... DTSRun OnStart: DTSStep_DTSDataPumpTask_1 DTSRun OnError: DTSStep_DTSDataPumpTask_1, Error = -2147467259 (80004005) Error string: [Microsoft][ODBC Microsoft Access Driver] Cannot start your application. The workgroup information file is missing or opened exclusively by another user. Error source: Microsoft OLE DB Provider for ODBC Drivers Help file: Help context: 0 Error Detail Records: Error: -2147467259 (80004005); Provider Error: 1901 (76D) Error string: [Microsoft][ODBC Microsoft Access Driver] Cannot start your application. The workgroup information file is missing or opened exclusively by another user. Error source: Microsoft OLE DB Provider for ODBC Drivers Help file: Help context: 0 DTSRun OnFinish: DTSStep_DTSDataPumpTask_1 DTSRun: Package execution complete. Process Exit Code 1. The step failed. Help!!!
View Replies !
Query Works Fine Outside Union, But Doesn't Work .. .
hi all I have the following query which works fine when it's executed as a single query. but when i union the result of this query with other queries, it returns a different set of data. any one know why that might be the case?? select top 100 max(contact._id) "_id", max(old_trans.date) "callback_date", 7 "priority", max(old_trans.date) "recency", count(*) "frequency" --contact._id, contact.callback_date from topcat.class_contact contact inner join topcat.MMTRANS$ old_trans on contact.phone_num = old_trans.phone where contact.phone_num is not null and contact.status = 'New Contact' group by contact._id order by "recency" desc, "frequency" desc i've included the union query here for completeness of the question begin declare @current_date datetime set @current_date = GETDATE() select top 100 _id, callback_date, priority, recency, frequency from ( ( select top 10 _id, callback_date, 10 priority, @current_date recency, 1 frequency --, DATEPART(hour, callback_date) "hour", DATEPART(minute, callback_date) "min" from topcat.class_contact where status ='callback' and (DATEPART(year, callback_date) <= DATEPART(year, @current_date)) and (DATEPART(dayofyear, callback_date) <= DATEPART(dayofyear, @current_date)) -- all call backs within that hour will be returned and (DATEPART(hour, callback_date) <= DATEPART(hour, @current_date)) and (DATEPART(hour, callback_date) <> 0) order by callback_date asc --order by priority desc, DATEPART(hour, callback_date) asc, DATEPART(minute, callback_date) asc, callback_date asc ) union ( select top 10 _id, callback_date, 9 priority, @current_date recency, 1 frequency from topcat.class_contact where status = 'callback' and callback_date is not null and (DATEPART(year, callback_date) <= DATEPART(year, @current_date)) and (DATEPART(dayofyear, callback_date) <= DATEPART(dayofyear, @current_date)) and (DATEPART(hour, callback_date) <= DATEPART(hour, @current_date)) and (DATEPART(hour, callback_date) = 0) order by callback_date asc ) union ( select top 10 _id, callback_date, 8 priority, @current_date recency, 1 frequency from topcat.class_contact where status = 'No Connect' and callback_date is not null and (DATEPART(year, callback_date) <= DATEPART(year, @current_date)) and (DATEPART(dayofyear, callback_date) <= DATEPART(dayofyear, @current_date)) and (DATEPART(hour, callback_date) <= DATEPART(hour, @current_date)) order by callback_date asc ) union ( select top 100 max(contact._id) "_id", max(old_trans.date) "callback_date", 7 "priority", max(old_trans.date) "recency", count(*) "frequency" --contact._id, contact.callback_date from topcat.class_contact contact inner join topcat.MMTRANS$ old_trans on contact.phone_num = old_trans.phone where contact.phone_num is not null and contact.status = 'New Contact' group by contact._id order by "recency" desc, "frequency" desc ) ) contact_queue order by priority desc, recency desc, callback_date asc, frequency desc end
View Replies !
Using Symmetric Key Problem With Encryption, Decryption Works Fine
Hey I had a table with a column of data encrypted in a format. I was able to decrypt it and then encrypt it using Symmetric keys and then updating the table column with the data. Now, there is a user sp which needs to encrypt the password for the new user and put it in the table. I'm not being able to make it work. I have this so far. Something somewhere is wrong. I dont know where. Please help Thanks. I used the same script to do the encryption initially but that was for the whole column. I need to see the encrypted version of the @inTargetPassword variable. But it's not working. It doesn't give me an error but gives me wrong data... declare @thePassword as varbinary(128) ,@inTargetPassword as varchar(255) ,@pwd3 as varchar(255) ,@theUserId bigint set @theUserId= 124564 set @inTargetPassword = 'test' OPEN SYMMETRIC KEY Key1 DECRYPTION BY CERTIFICATE sqlSecurity; Select @pwd3=EncryptByKey(Key_GUID('Key1') , @inTargetPassword, 1, HashBytes('SHA1', CONVERT( varbinary, [UserObjectId]))) from table1 where UserObjectId= @theUserId close symmetric key Key1
View Replies !
Slow Query....drop Index Works Fine!!!!!
We are running MS RS and SQL Server 2000 SP3. We have one LEDGER, where all the daily activities are stored. The LEDGER table has 4 indexes (1 clustered and 3 non-clustered). To get AR we use this table. Well problem is some times in 1-2 months, any simple AR query takes a long time and every other client gets slow response (queries are very slow or sometimes block). If we DROP any index on LEDGER table and again put it back (RECREATE), all our queries work fine and faster. This goes on till 1-2 months, till we see the same issue again. This is a classic case happened today. Queries were running fine till morning 8 AM. We upload some 50 thousand records to Ledger table (Data Conversion). Well after 30 mins, all simple AR queries started taking a long time. We DROPPED an index in LEDGER table and everything was faster....Just to be same we added back the same index again.......everything is Faster..... What is this. ....is it our QUERY, index or huge Transactions or no free space ??? We are scheduled to run SP4, next week. But is there any solution in the mean time on what is this? Also is they any way to KILL all SQL server processes that take more than a mins. We just don't want ALL our client to Slow down because of one query???? Thanks,
View Replies !
Report Works Fine Stand Alone, But Fails When Used As Subreport
I have a report which I have tested and works fine. now I'm trying to use it as a subreport. the "outer" or main report is very simple: it just has a company standard banner and some header/footer information, and then a single subreport. there is no passing of parameters between main report and sub report. the subreport does have its own parameter to govern its dataset, and provides its own default for that. The error that I'm getting is this: [rsErrorExecutingSubreport] An error occurred while executing the subreport €˜subreport1€™: An error has occurred during report processing. [rsMissingFieldInDataSet] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Year€™. This field is missing from the returned result set from the data source. [rsErrorReadingDataSetField] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Year€™. The data extension returned an error during reading the field. [rsMissingFieldInDataSet] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Month€™. This field is missing from the returned result set from the data source. [rsErrorReadingDataSetField] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Month€™. The data extension returned an error during reading the field. [rsMissingFieldInDataSet] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Date€™. This field is missing from the returned result set from the data source. [rsErrorReadingDataSetField] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Date€™. The data extension returned an error during reading the field. [rsMissingFieldInDataSet] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Wt_TO_MTD€™. This field is missing from the returned result set from the data source. [rsErrorReadingDataSetField] The data set €˜WarrantMasterCube€™ contains a definition for the Field €˜Wt_TO_MTD€™. The data extension returned an error during reading the field. [rsNone] An error has occurred during report processing. Of course, this doesn't happen when I execute the subreport by itself. What kinds of things should I be looking at to get to the bottom of this. Thanks!
View Replies !
Multivalue Works Fine In The Sproc But Not In Bids Or Reportserver
Hi, I have a report which has multivalue parameters enabled and If i give NULL it displays everything correctly. But if I give different ClientId it doesnt do it in the report.. But if i run my sproc in VS2005 and in ssms it works the way i want it. this is my sproc Code Snippet set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER Procedure [dbo].[usp_GetOrdersByOrderDate] @StartDate datetime, @EndDate datetime, @ClientId nvarchar(max)= NULL AS Declare @SQLTEXT nvarchar(max) if @ClientId is NULL BEGIN SELECT o.OrderId, o.OrderDate, o.CreatedByUserId, c.LoginId, o.Quantity, o.RequiredDeliveryDate, cp.PlanId, cp.ClientPlanId --cp.ClientId FROM [Order] o Inner Join ClientPlan cp on o.PlanId = cp.PlanId -- and o.CreatedByUserId = cp.UserId Inner Join ClientUser c on o.CreatedByUserId = c.UserId WHERE --cp.ClientId = @ClientId --AND o.OrderDate BETWEEN @StartDate AND @EndDate ORDER BY o.OrderId DESC END ELSE BEGIN SELECT @SQLTEXT = 'Select o.OrderId, o.OrderDate, o.CreatedByUserId, c.LoginId, o.Quantity, o.RequiredDeliveryDate, cp.PlanId, cp.ClientPlanId --cp.ClientId FROM [Order] o Inner Join ClientPlan cp on o.PlanId = cp.PlanId --AND cp.ClientId in ('+ convert(Varchar, @ClientId) + ' ) Inner Join ClientUser c on o.CreatedByUserId = c.UserId WHERE cp.ClientId in (' + convert(Varchar,@ClientId) + ') AND o.OrderDate BETWEEN ''' + Convert(varchar, @StartDate) + ''' AND ''' + convert(varchar, @EndDate) + ''' ORDER BY o.OrderId DESC' exec(@SQLTEXT) END --return (@SQLTEXT) I have 2 datasets in this report one for the above sproc and other dataset that gives me the clientname and it is as follows Code Snippet ALTER Procedure [dbo].[usp_GetClientsAll] @ClientId nvarchar(max) = NULL AS --Declare @ClientId nvarchar(max) SELECT NULL ClientId, '<All Clients >' ClientName FROM Client Union SELECT ClientId, ClientName FROM Client Where ClientId = @ClientId OR ( ClientId = ClientId OR @ClientId IS NULL ) In the first dataset Parameter list i have omitted ClientId but kept it in the report parameter.. So when i give select all it works.. but when i just select particular it gives me the same result as Select all.. any help will be appreciated.. REgards Karen
View Replies !
Problems Publishing My Personal Website - Works Fine Locally!
People,I'm trying to publish my first website and am having a few problems.I've got Visual Web Developer 2005 Express and am trying to use the Personal Website Starter Kit. (my SQL server is SQL Server Express Edition 2005 - which is also running on my local machine)It seems to work fine when I run it on my localhost, as soon as I ftp it up to my web hosting company, I get an error message (see below) :-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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) My hypothesis is :-It would appear to me that when running locally, the starter kit website uses my installation of SQL 2005 Express Edition, but when I upload all the files, I'm guessing the application is still trying to point at a local instance of SQL on my local PC which it now cannot see. I'm guessing I need to somehow upload the SQL database onto my web host (I've purchased 100M of SQL Server 2005 space), and point the application at that SQL instance instead. But I don't know if I'm right about all this, or indeed how to do it if I am. Can anyone help?Much thanks in advance,Will
View Replies !
Long Running Query In SQL 2005 But Works Fine In SQL 2000
I have a simple update statement that is running forever in SQL 2005 but works fine in SQL 2000. We have a new server we put SQL 2005, restored db. The table in question WEEKLYSALESHISTORY I even re-indexed all the indexes and rebuilt the stats as well. But still no luck, still running extremely long. 1 hour 20 minutes. I'll try to give you some background on these table. Weeklysalehistory has approx 30 fields. I have 11 indesxes set up weekending date being one of them. And replication control has index on lasttrandatetime as well. So I think my indexes are fine. /* Update WeekEnding Date for current weeks WeeklySales Records */ Update WeeklySalesHistory set weekendingdate = (SELECT LastTransDateTime from ReplicationControl where TableName = 'WEEKHST') where weekendingdate is null Weekly sales has approx 100,000,000 rows Replication control has 631,000 (Ithink I can delete some from here to bring it down to 100 or 200 records) Although I don't think this is issue since on 2000 has same thing and works fine. I was trying to do this within SSIS and thought that was issue. I am new so SSIS but it runs long even if I just run it as a job with this simple Update statement so I think its something with tables, etc that is wrong. One thing on noticed if I look at the statistics in SQL Server Management studio there is a ton of stats. some being statistics on indexes which makes sense then I have a ton of hind_113_9_6 and simiiar one like this. I must have 90 or so named like this. Not sure how to check on SQL 2000 all the stats to see if they moved over from there or what. I checked a few other tables and don't have all these extra stats. Could this be causing the issue do I need to delete all these extras? Any help would be greatly appreciated. Stacy
View Replies !
Permission Issue With Tempdb Works Fine In SQL2000 But Not SQL2005
the following SQL works fine in SQL2000 but gets a permissions error when run on SQL2005: IF not exists (SELECT * FROM tempdb.dbo.sysindexes WHERE NAME = 'PK_tblGuidContractMove') BEGIN IF @DEBUG = 1 PRINT 'airsp_CopyContracts.PK_tblGuidContractMove' EXECUTE('ALTER TABLE #tblGuidContractMove ALTER COLUMN guidSource GUID NOT NULL') EXECUTE('ALTER TABLE #tblGuidContractMove ALTER COLUMN guidDestination GUID NOT NULL') EXECUTE('ALTER TABLE #tblGuidContractMove ALTER COLUMN guidContractMove GUID NOT NULL') EXECUTE('ALTER TABLE #tblGuidContractMove WITH NOCHECK ADD CONSTRAINT [PK_tblGuidContractMove] PRIMARY KEY CLUSTERED ( [guidSource], [guidDestination], [guidContractMove] ) ON [PRIMARY]') END The user permissions are set the same in both 2000 and 2005 can you please explain what changed and what are the minimum permissions need for the user to be able to make these changes to the temporary table which the user created.
View Replies !
Stored Procedure Works Only Once.
HiI am using stored procedure in my asp.net application.filling stored procedure in datagrid.output of stored procedure is a temprory table.but resultset is blank for second time.after reconnecting to connection it is working.what is the problem?help me Thank you,
View Replies !
Havin Trouble Inserting Records To A Table.. Update Works Fine
Hi.. I am getting a xml stream of data and putting it to a object and then calling a big sproc to insert or update data in many tables across my database... But there is one Table that i am having trouble inserting it.. But if i run an update it works fine... This my code for that part of the sproc.. IF Exists( SELECT * FROM PlanEligibility WHERE PlanId = @PlanId ) BEGIN UPDATE PlanEligibility SET LengthOfService = Case When @PD_EmployeeContribution = 0 Then @rsLengthOfServicePS ELSE @rsLengthOfService END, EligibilityAge = CASE When @PD_EmployeeContribution = 0 Then @EligibilityAgePS Else @EligibilityAge End, EntryDates = @EntryDates, EligiDifferentRequirementsMatch = Case When @PD_EmployeeContribution = 0 Then 0 When @PD_EmployeeContribution = 1 and @PD_EmployerContribution = 0 then 0 Else 1 END, --@CompMatchM, LengthOfServiceMatch = CASE When @MCompanyMatch = 0 Then @rsLengthOfServicePs ELSE @rsLengthOfServiceMatch END, EligibilityAgeMatch = CASE When @MCompanyMatch = 0 Then @EligibilityAgePS ELSE @EligibilityAgeMatch END, OtherEmployeeExclusions = @OtherEmployeeExclusions WHERE PlanId = @PlanId END ELSE BEGIN INSERT INTO PlanEligibility ( PlanId, LengthOfService, EligibilityAge, EntryDates, EligiDifferentRequirementsMatch, LengthOfServiceMatch, EligibilityAgeMatch, OtherEmployeeExclusions ) VALUES ( @PlanId, Case When @PD_EmployeeContribution = 0 Then @rsLengthOfServicePS ELSE @rsLengthOfService END,--@rsLengthOfService, CASE When @PD_EmployeeContribution = 0 Then @EligibilityAgePS Else @EligibilityAge End, --@EligibilityAge, @EntryDates, Case When @PD_EmployeeContribution = 0 Then 0 When @PD_EmployeeContribution = 1 and @PD_EmployerContribution = 0 then 0 Else 1 END, --having trouble here CASE When @MCompanyMatch = 0 Then @rsLengthOfServicePs ELSE @rsLengthOfServiceMatch END, CASE When @MCompanyMatch = 0 Then @EligibilityAgePS ELSE @EligibilityAgeMatch END, --EligibilityAgeMatch,@EligibilityAgeMatch, @OtherEmployeeExclusions ) END Any help will be appreciated.. Regards, Karen
View Replies !
Stored Procedure Works But Nothing Returned?
Hello, I have the following stored prod in SQL server: CREATE PROC spValidateUserIdAndPassword @UserIdvarchar(50), @Passwordvarchar(50) AS SELECT tblAdvertisers.UserID, tblAdvertisers.Password FROM tblAdvertisers WHERE ((tblAdvertisers.UserID = @UserId) AND (tblAdvertisers.Password = @Password)) I can run it in Query Analyzer and it returns one record as it should. I want it in ASP.NET to return the amount of rows that are effected, e.g that the login is correct. The code I have is: public bool ValidateUserIdAndPassword(string userId, string password) { sqlCommand.CommandType = CommandType.StoredProcedure; //the name of the stored procedure sqlCommand.CommandText = "spValidateUserIdAndPassword"; SqlParameter myParam; //add the param's to the SP //userId information for the user myParam = new SqlParameter("@UserId", SqlDbType.VarChar, 50); myParam.Value = CStr(userId); sqlCommand.Parameters.Add(myParam); //password information for the user myParam = new SqlParameter("@Password", SqlDbType.VarChar, 50); myParam.Value = CStr(password); sqlCommand.Parameters.Add(myParam); try { int rows = sqlCommand.ExecuteNonQuery(); if(rows == 1) return true; else return false; } catch(System.Exception er) { //for design time error checking return false; } This returns -1... Please help me Kind Regards KitkatRobins :-)
View Replies !
SQL 2000 Partitioned View Works Fine, But CURSOR With FOR UPDATE Fails To Declare
This one has me stumped. I created an updateable partioned view of a very large table. Now I get an error when I attempt to declare a CURSOR that SELECTs from the view, and a FOR UPDATE argument is in the declaration. There error generated is: Server: Msg 16957, Level 16, State 4, Line 3 FOR UPDATE cannot be specified on a READ ONLY cursor Here is the cursor declaration: declare some_cursor CURSOR for select * from part_view FOR UPDATE Any ideas, guys? Thanks in advance for knocking your head against this one. PS: Since I tested the updateability of the view there are no issues with primary keys, uniqueness, or indexes missing. Also, unfortunately, the dreaded cursor is requried, so set based alternatives are not an option - it's from within Peoplesoft.
View Replies !
Table Visibility Not Functioning Correctly On Server, Works Fine In Visual Studio
I have a report problem. I'm using a parameter to dynamically control visibility for two tables. If the parameter is set to one value, I want to switch one of the tables to invisible, if the parameter is set to another, I want the other table to be invisible instead. This all works fine in Visual Studio. When I publish it to my report server, the visibility controls no longer function and both tables always display. Any ideas here? I'm running 2005, SP2 CTP.
View Replies !
Stored Procedure Only Works In When App Uses Trusted Security
Hi,I have a .NET application that connects to a SQL 2000 database usingtrusted security. It eventually calls a stored procedure that receives3 parameters - nothing special.If I simply change the connection string to use a valid Userid andPassword it still connects to the DB w/o problems but when it executesthe SP I get the following:System.Data.SqlClient.SqlException: Invalid length parameter passed tothe substring function.I change nothing but the login. Same store procedure, same parameters.Any ideas?
View Replies !
Stored Procedure Works, Agent Job Aborts
One of my clients has a stored procedure on their secondary server thatcopies a bunch of data from the production server. (Replication willbreak the accounting software, according to its authors. The productionserver generates a nightly full backup, so if the secondary can bescripted to do a nightly restore from that same file, then that wouldprobably be a Big Win.)Anyway, if I execute the stored procedure from Query Analyzer, itfinishes (after nearly 24 hours) - tested once recently, and I'm sureat least a few times at some point in the past. If I run a SQL ServerAgent job that executes the stored procedure, then it gets cut off afterabout 15-20 minutes - tested once recently with a manual run, and forseveral weeks of scheduled runs before that. (This being a secondaryserver, it took a while for the problem to be noticed.) What are thelikely causes of this?Both servers are running SQL 2K with SP3, and limited to TCP/IP andnamed pipes. RPC is allowed, with a 600-second timeout, but thatdoesn't seem relevant, since both the successful and unsuccessfulmethods go well past that length. The production server is a recentpurchase, and works well for their daily operations; the secondaryserver and/or its network connection might be flaky for all I know,but that doesn't seem relevant either, since success appears todepend consistently on method of execution.
View Replies !
Xp_sendmail: Failed With Mail Error 0x80040111 It Works Fine When You Do A Test From Enterprise Manager
Hello I am receiving the dreaded mail error listed above. I can send out a test E-mail from Enterprise Manager to operators, but I cannot run this Transact query: EXEC master.dbo.xp_sendmail @RECIPIENTS = araz***@***.com(removed email address), @SUBJECT = 'test' I receive: Server: Msg 18025, Level 16, State 1, Line 0 xp_sendmail: failed with mail error 0x80040111 I have stopped/restarted the SQL SERVER AGENT but haven't done much else as I haven't been able to. Should it work through transact SQL if the test email works from Enterprise Manager? This is SQL 2000 SP4 running on Win2K in the domain. Thank you.
View Replies !
Stored Procedure Works In Dataset Editor, But Not In Report
I have a stored procedure that works in my dataset editor, but when i try to run the report, only the "amount" field shows up. Everything else is blank. why is this happening. Here is the stored procedure. USE [RC_STAT] GO /****** Object: StoredProcedure [dbo].[PROC_TE_MKT_DETAIL_EXPENSE] Script Date: 06/21/2007 09:56:01 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[PROC_TE_MKT_DETAIL_EXPENSE] (@Territory varchar(10) = Null) AS BEGIN IF @Territory IS Null BEGIN SELECT [Item_Description]+' '+'('+[Item_No]+')' Entry_Description ,ISNULL(RC_STAT.dbo.udf_Correct_Price(Item_No, Item_Ledger_Posting_Datetime, 'SALESAMP') * -1*Item_Ledger_Invoiced_Qty,Item_Ledger_Cost_Posted_GL * -1 ) Amount ,-1*[Item_Ledger_Invoiced_Qty] Quantity ,Customer_Name ,'' External_Doc_no ,[Item_Ledger_Sales_Responsible] SR_Code ,[Item_Ledger_Mars_Period_Code] ThePeriod , Budget_Reporting_Group.Budget_Reporting_Group_Description , Budget_Type.Budget_Type_Code, Budget_Type.Budget_Type_Description , Budget_Reporting.Budget_Forecast_Period, Salesperson_Purchaser.SalesPerson_Purchaser_Code , Salesperson_Purchaser.SalesPerson_Purchaser_Description , CASE WHEN Budget_Reporting_Group.Budget_Reporting_Group_Id = 1 THEN Budget_Reporting_Amount ELSE - 1 * Budget_Reporting_Amount END AS Amount , Salesperson_Purchaser.Territory_Code ,Territory.Name AS Territory_Name ,Region.Region AS Region_Name , Budget_Reporting_Group.Budget_Reporting_Group_Id FROM RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting AS Budget_Reporting INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting_Group AS Budget_Reporting_Group ON Budget_Reporting_Group.Budget_Reporting_Group_Id = Budget_Reporting.Budget_Reporting_Group_Id INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Type AS Budget_Type ON Budget_Reporting.Budget_Type_Code = Budget_Type.Budget_Type_Code INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser ON Budget_Reporting.SalesPerson_Purchaser_Code = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN [NavisionReplication].[dbo].[Qry_Item_Ledger_Detail] ON [Item_Ledger_Sales_Responsible] = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory ON Territory.Code = Salesperson_Purchaser.Territory_Code LEFT OUTER JOIN RC_DWDB_INSTANCE_1.dbo.Region AS Region ON Territory.Region_Key = Region.Region_Key WHERE Budget_Reporting.Budget_Year = 2007 AND Budget_Type.Budget_Type_Code in ('T&E', 'MKT') END IF @Territory IS NOT Null BEGIN SELECT Budget_Reporting_Group.Budget_Reporting_Group_Description , Budget_Type.Budget_Type_Code, Budget_Type.Budget_Type_Description , Budget_Reporting.Budget_Forecast_Period, Salesperson_Purchaser.SalesPerson_Purchaser_Code , Salesperson_Purchaser.SalesPerson_Purchaser_Description , CASE WHEN Budget_Reporting_Group.Budget_Reporting_Group_Id = 1 THEN Budget_Reporting_Amount ELSE - 1 * Budget_Reporting_Amount END AS Amount , Salesperson_Purchaser.Territory_Code ,Territory.Name AS Territory_Name ,Region.Region AS Region_Name , Budget_Reporting_Group.Budget_Reporting_Group_Id FROM RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting AS Budget_Reporting INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Reporting_Group AS Budget_Reporting_Group ON Budget_Reporting_Group.Budget_Reporting_Group_Id = Budget_Reporting.Budget_Reporting_Group_Id INNER JOIN RC_DWDB_INSTANCE_1.dbo.Tbl_Budget_Type AS Budget_Type ON Budget_Reporting.Budget_Type_Code = Budget_Type.Budget_Type_Code INNER JOIN NavisionReplication.dbo.Tbl_Salesperson_Purchaser AS Salesperson_Purchaser ON Budget_Reporting.SalesPerson_Purchaser_Code = Salesperson_Purchaser.SalesPerson_Purchaser_Code INNER JOIN RC_DWDB_INSTANCE_1.dbo.Territory AS Territory ON Territory.Code = Salesperson_Purchaser.Territory_Code LEFT OUTER JOIN RC_DWDB_INSTANCE_1.dbo.Region AS Region ON Territory.Region_Key = Region.Region_Key WHERE Territory.Code = @Territory AND Budget_Reporting.Budget_Year = 2007 AND Budget_Type.Budget_Type_Code in ('T&E', 'MKT') END END
View Replies !
Cursor Works In Query Analyzer But Not In Stored Procedure
Hi i have a script works in sql query analyzer; declare @id decimal declare mycur CURSOR SCROLL for select myRowID from myTable order by myRowID open mycur; Fetch ABSOLUTE 30 from mycur into @id close mycur; deallocate mycur; select @id this script turns me a value. i create a stored procedure from above script and its syntax is ok; CREATE PROCEDURE SELECT_MyRow AS declare @cur cursor declare @RowID decimal set @cur = CURSOR SCROLL for select myRowID from myTable order by myRowID open @cur Fetch ABSOLUTE 30 from @cur into @RowID close @cur deallocate @cur select @RowID GO my c# code using stored procedure is below; Code Snippet try { OleDbCommand cmd = new OleDbCommand("SELECT_MyRow", myconnection); cmd.CommandType = CommandType.StoredProcedure; myconnection.Open(); OleDbDataReader reader = cmd.ExecuteReader(); MessageBox.Show(reader.GetName(0));//here fails while (reader.Read()) { MessageBox.Show(reader.GetDecimal(0).ToString()); } reader.Close(); myconnection.Close(); } catch(Exception ex) { MessageBox.Show(ex.Message); } The code above fails because reader reads no values, error message is "No data exists for the row/column" but i know exists. Can anyone help me, what is the difference between stored procedure and script ?
View Replies !
RESTORE FILELIST Is Terminating Abnormally Error When Running A DTS Package In SQL 2005. Works Fine In SQL 2000
Currently I receive the following error when executing script within a DTS package in SQL 2005 (it seems to be working in SQL 2000): Processed 27008 pages for database 'Marketing', file 'Marketing_Data' on file 5. Processed 1 pages for database 'Marketing', file 'Marketing_Log' on file 5. BACKUP DATABASE successfully processed 27009 pages in 15.043 seconds (14.708 MB/sec). (5 row(s) affected) Msg 213, Level 16, State 7, Line 1 Insert Error: Column name or number of supplied values does not match table definition. Msg 3013, Level 16, State 1, Line 1 RESTORE FILELIST is terminating abnormally. The code I am using is: -- the original database (use 'SET @DB = NULL' to disable backup) DECLARE @DB varchar(200) SET @DB = 'Marketing' -- the backup filename DECLARE @BackupFile varchar(2000) SET @BackupFile = 'C:SQL2005 dbsMarketing.dat' -- the new database name DECLARE @TestDB2 varchar(200) SET @TestDB2 = datename(month, dateadd(month, -1, getdate())) + convert(varchar(20), year(getdate())) + 'Inst1' -- the new database files without .mdf/.ldf DECLARE @RestoreFile varchar(2000) SET @RestoreFile = 'C:SQL2005 dbs' + @TestDB2 DECLARE @RestoreLog varchar (2000) SET @RestoreLog = 'C:SQL2005 dbs' + @TestDB2 -- **************************************************************** -- no change below this line -- **************************************************************** DECLARE @query varchar(2000) DECLARE @DataFile varchar(2000) SET @DataFile = @RestoreFile + '.mdf' DECLARE @LogFile varchar(2000) SET @LogFile = @RestoreLog + '.ldf' IF @DB IS NOT NULL BEGIN SET @query = 'BACKUP DATABASE ' + @DB + ' TO DISK = ' + QUOTENAME(@BackupFile, '''') EXEC (@query) END -- RESTORE FILELISTONLY FROM DISK = 'C: empackup.dat' -- RESTORE HEADERONLY FROM DISK = 'C: empackup.dat' -- RESTORE LABELONLY FROM DISK = 'C: empackup.dat' -- RESTORE VERIFYONLY FROM DISK = 'C: empackup.dat' IF EXISTS(SELECT * FROM sysdatabases WHERE name = @TestDB2) BEGIN SET @query = 'DROP DATABASE ' + @TestDB2 EXEC (@query) END RESTORE HEADERONLY FROM DISK = @BackupFile DECLARE @File int SET @File = @@ROWCOUNT DECLARE @Data varchar(500) DECLARE @Log varchar(500) SET @query = 'RESTORE FILELISTONLY FROM DISK = ' + QUOTENAME(@BackupFile , '''') CREATE TABLE #restoretemp ( LogicalName varchar(500), PhysicalName varchar(500), type varchar(10), FilegroupName varchar(200), size int, maxsize bigint ) INSERT #restoretemp EXEC (@query) SELECT @Data = LogicalName FROM #restoretemp WHERE type = 'D' SELECT @Log = LogicalName FROM #restoretemp WHERE type = 'L' PRINT @Data PRINT @Log TRUNCATE TABLE #restoretemp DROP TABLE #restoretemp IF @File > 0 BEGIN SET @query = 'RESTORE DATABASE ' + @TestDB2 + ' FROM DISK = ' + QUOTENAME(@BackupFile, '''') + ' WITH MOVE ' + QUOTENAME(@Data, '''') + ' TO ' + QUOTENAME(@DataFile, '''') + ', MOVE ' + QUOTENAME(@Log, '''') + ' TO ' + QUOTENAME(@LogFile, '''') + ', FILE = ' + CONVERT(varchar, @File) EXEC (@query) END
View Replies !
Beginner Question: What Is The &"SELECT&" Here For? - In Stored Procedure
Hi: I am learning "stored procedure": whis is the SELECT 1, 2, and 3 for in below ======================ALTER PROCEDURE [dbo].[AddToFavourites] ( @Username varchar(20), @Favourite varchar(20), @MaxFavouriteUsers int)AS IF ((SELECT COUNT(*) FROM Favourites WHERE @Username = u_username AND @Favourite = f_username) <> 0) SELECT 2 ELSE IF ( (SELECT COUNT(*) FROM Favourites WHERE @Username = u_username) >= @MaxFavouriteUsers) SELECT 3 ELSE BEGIN INSERT INTO Favourites (u_username, f_username) VALUES (@Username,@Favourite) SELECT 1 END ======================= Thanks in advance! jt
View Replies !
Problem With Link Server From Sql 2005 To Sql 2005 - Openquery Doesnt Works
I have created a linked server on which following query works fine. EXECUTE ('SELECT TOP 10 * FROM dummyOBJECTS') AT [REMOTE] but the same statement executed with openquery select * from openquery([remote],'select top 10 * from dummyObjects') returns following error. Msg 7356, Level 16, State 1, Line 1 The OLE DB provider "SQLNCLI" for linked server "remote" supplied inconsistent metadata for a column. The column "dummyObjectID" (compile-time ordinal 1) of object "select top 10 * from dummyobjects" was reported to have a "Incomplete schema-error logic." of 0 at compile time and 0 at run time.
View Replies !
OR Works Fine, When I Add AND Things Go Wrong (was &"Help With Simple Query&")
Hi I really need some help I have been banging my head against a brick wall for the last day or so... I need some assistance with a query. Maybe what I am trying to do is not possible but I am sure it is. I have a ASP page with a SQL 2005 Express backend. I would like to query a table based on a dropdownlist and checkboxes on my form. The perameter in the drop down list is a service so I am querying records based on a service. The checkboxes are locations such as north,east, south and west. So I am building OR statements with these. For example I am looking for plumbers in the north and east. The OR part works fine. Its when I add the service into the query things go wrong. Here is my tables Company --------- PK CompanyID ComapnyName Service -------- PK ServiceID FK CompanyID ServiceName Region -------- PK RegionID FK CompanyID North East South West The below works fine when querying companies in different locations: SELECT TblCompany.CompanyID, TblCompany.CompanyName, TblRegion.North, TblRegion.East, TblRegion.South, TblRegion.West FROM TblCompany INNER JOIN TblRegion ON TblCompany.CompanyID = TblRegion.CompanyID WHERE (TblRegion.Scotland = @Pram1) OR (TblRegion.Wales = @Pram2) OR (TblRegion.NorthEast = @Pram3) OR (TblRegion.NorthWest = @Pram4) Now the problem is when I add in the service table. Sometimes I get all records returned. So even if I query a plumber in the south and east I get records for companies that dont even have a particular service in the perameter. I can provide more info if need - I am guessing my design is all wrong. The way I see this happening from a GUI is a dropdown being the service WHERE perameter and the truefalse BIT tick boxes being the OR perameters - any help would be great - many thanks in advance.
View Replies !
Sql Report Works Fine On Internal Servers - Hosed On External Servers - Need Some Help
I have a report that was designed using SQL Reporting Services that sits on a SQL reporting server. It's nothing too exciting, it is essentially a three page application with legal jumbo on pages 2 and 3 and applicant data in fields on page 1. We use rectangles to force page breaks to page 2 and to page 3. When running the report on the report server, it shows and prints fine. When running the report from the QA website internally, it shows and prints just fine. When running the report from the production website from a machine internally, it shows and prints just fine. When running the report from outside of the company network, the report is jacked. It obliterates large chunks of text, crams text together, and creates blank pages. I need help in determining where I even begin with trouble shooting this!
View Replies !
Stored Procedure Works But Very Slow (was &"Optimization&")
I have a big table A_newHistory (more than 2 million rows) with primary key fund_id + date_price . This table has to be updated every 2 hours from XML. Every row in XML must be inserted or updated (if current id and date already exist in the table) in the A_newHistory. The following procedure works but very slow... How can I optimize that? ================================================== ======= CREATE PROCEDURE spSaveFundsAdjustedClose @XML ntext AS DECLARE @fund_id int DECLARE @date_price datetime DECLARE @adj_closed float DECLARE @XMLDoc int SET TRANSACTION ISOLATION LEVEL SERIALIZABLE BEGIN TRANSACTION EXEC sp_xml_preparedocument @XMLDoc OUTPUT, @XML DECLARE MutualFunds_Cursor CURSOR LOCAL FAST_FORWARD READ_ONLY FOR SELECT * FROM OPENXML (@XMLDoc , '/xml/a', 1) WITH ([id] INT,[date] datetime, price float) OPEN MutualFunds_Cursor FETCH NEXT FROM MutualFunds_Cursor INTO @fund_id, @date_price, @adj_closed WHILE @@FETCH_STATUS = 0 BEGIN IF EXISTS (SELECT * FROM A_newHistory WHERE id_fund = @fund_id AND date_price = @date_price) BEGIN UPDATE A_newHistory SET adj_close = @adj_closed WHERE id_fund = @fund_id AND date_price = @date_price END ELSE BEGIN INSERT INTO A_newHistory VALUES(@fund_id, @date_price, @adj_closed) END IF @@Error <> 0 BEGIN ROLLBACK TRANSACTION SELECT -1 RETURN END FETCH NEXT FROM MutualFunds_Cursor INTO @fund_id, @date_price, @adj_closed END EXEC sp_xml_removedocument @XMLDoc CLOSE MutualFunds_Cursor DEALLOCATE MutualFunds_Cursor COMMIT TRANSACTION SELECT 0 GO ================================================== =======
View Replies !
MS Access Back-end Works Fine, But SQL Server Back End NOT Working For Access Project
Hi I have 2 forms, each associated with its own table - they are linked together only by the fact that they share a common field, CustomerID.... I create a form (for table 1, called Customers) that brings up another form (for table 2, called Projects) based on the CustomerId that is selected in the first form from the Customers table - with a SQL back end it brings up ALL records in the second form (for the second table) with any CustomerIDs that exist in both tables - I set the link criteria [forms]![Customers]![CustomerID] and with an MS access back-end it works fine, but with a SQL back end it still returns ALL records with any ID that matches....not just the one I selected in the Customers form..... why?? thanks for reading this and for your help...
View Replies !
Need Help With Stored Proc (Beginner)
This stored procedure is missing one thing. The product information, the only way i can link those fields, is if i grab the Item_no, from the Tbl_product_Activity table. The only problem with this is i keep gettin too many records when i try an inner join. Is there someone way i can List it in the selct statement for the sub guery. Tbl_Product_Activity is the only table in the stored procedure that has the Item_no. But as you can see in the subquery im grabbing fields from there, but i exculde the item number, so i can group and get a quantity count. How can i get that field in the stored procedure , so im able to link other fields from the product table. would i be able to add another subquery that looks like this: SELECT ITEM_NO FROM TBL_PRODUCT_ACTIVITY ???? any help will be greatly appreciated. Code Block set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[PROC_RPT_BANFIELD_PRODUCT_ACTIVITY] (@Region_Key int) AS BEGIN SELECT DAS.Territory_Code, DAS.SR_Code, DAS.Customer_code, Product_Activity.Item_status_code, DATEPART(Dw, DAS.Daily_activity_statistics_datetime) AS DayOfWeek, DAS.Daily_activity_statistics_datetime, COUNT(*) AS Visit_Count, Product_Activity.Product_Qty, ud_customer_hierarchy.type_code, ud_customer_hierarchy.group_code, Qry_Sales_Group.Region_Key, Qry_Sales_Group.Region, Qry_Sales_Group.Name AS Territory_Name, customer.name AS customer_name FROM dbo.Tbl_Daily_Activity_Statistics AS DAS INNER JOIN ud_customer_hierarchy ON DAS.Customer_code = dbo.ud_customer_hierarchy.customer_code INNER JOIN Qry_Sales_Group ON DAS.SR_Code = dbo.Qry_Sales_Group.SalesPerson_Purchaser_Code COLLATE Latin1_General_CI_AS INNER JOIN customer ON DAS.Customer_code = dbo.customer.customer_code LEFT OUTER JOIN (SELECT Customer_code, Visit_date, Item_status_code, SUM(Item_Qty) AS Product_Qty FROM Tbl_Product_Activity WHERE Returns_reason_code='1' or returns_reason_code = 'null' GROUP BY Customer_code, Visit_date, Item_status_code) AS Product_Activity ON DAS.Customer_code = Product_Activity.Customer_code AND DAS.Daily_activity_statistics_datetime = Product_Activity.Visit_date WHERE (DAS.question_code = '9999') GROUP BY DAS.Territory_Code, DAS.SR_Code, DAS.Customer_code, Product_Activity.Item_status_code, DAS.Daily_activity_statistics_datetime, Product_Activity.Product_Qty, dbo.ud_customer_hierarchy.type_code, dbo.ud_customer_hierarchy.group_code, dbo.Qry_Sales_Group.Region_Key, dbo.Qry_Sales_Group.Region, dbo.Qry_Sales_Group.Name, customer.name HAVING (dbo.ud_customer_hierarchy.type_code = 'BA') AND (dbo.ud_customer_hierarchy.group_code = 'YES') AND (DAS.Daily_activity_statistics_datetime >= DATEADD(dd, - 7, DATEADD(dd, 1 - DATEPART(w, GETDATE()), CONVERT(varchar, GETDATE(), 101)))) AND (DAS.Daily_activity_statistics_datetime< DATEADD(dd, 0, DATEADD(dd, 1 - DATEPART(w, GETDATE()), CONVERT(varchar, GETDATE(), 101)))) AND @REGION_KEY=REGION_KEY ORDER BY DAS.Customer_code, DAS.Daily_activity_statistics_datetime, Product_Activity.Item_status_code END
View Replies !
Preview Vs. Print Preview
Hi, I created this report, but when I look at the report in Preview mode in the designer, it's different than when I look at it with the Print Preview. Why is that? It's correct when I look at the Print Preview. All I have is a list with an image in it, so the image repeats for every page. And over the image I placed text boxes so the words fit around and between the image. But when I view it in Preview mode, everything doesn't fit quite right. Any help would be appreciated! ~Stephanie
View Replies !
IsNull() Works In Query But Not In Stored Procedur
Hi, I'm using IsNULL(<insert something SQL witty here>) to zero out a derived column if there's no return result. When I submit my query in Management Console the results come back perfectly, when I send it over as a stored procedure (as an alter or create) then execute, my last few columns come back 0 not populated as in the query run. Anyone know why this happens?
View Replies !
Calling A Stored Procedure From ADO.NET 2.0-VB 2005 Express: Working With SELECT Statements In The Stored Procedure-4 Errors?
Hi all, I have 2 sets of sql code in my SQL Server Management Stidio Express (SSMSE): (1) /////--spTopSixAnalytes.sql--/// USE ssmsExpressDB GO CREATE Procedure [dbo].[spTopSixAnalytes] AS SET ROWCOUNT 6 SELECT Labtests.Result AS TopSixAnalytes, LabTests.Unit, LabTests.AnalyteName FROM LabTests ORDER BY LabTests.Result DESC GO (2) /////--spTopSixAnalytesEXEC.sql--////////////// USE ssmsExpressDB GO EXEC spTopSixAnalytes GO I executed them and got the following results in SSMSE: TopSixAnalytes Unit AnalyteName 1 222.10 ug/Kg Acetone 2 220.30 ug/Kg Acetone 3 211.90 ug/Kg Acetone 4 140.30 ug/L Acetone 5 120.70 ug/L Acetone 6 90.70 ug/L Acetone ///////////////////////////////////////////////////////////////////////////////////////////// Now, I try to use this Stored Procedure in my ADO.NET-VB 2005 Express programming: //////////////////--spTopSixAnalytes.vb--/////////// Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sqlConnection As SqlConnection = New SqlConnection("Data Source = .SQLEXPRESS; Integrated Security = SSPI; Initial Catalog = ssmsExpressDB;") Dim sqlDataAdapter As SqlDataAdapter = New SqlDataAdaptor("[spTopSixAnalytes]", sqlConnection) sqlDataAdapter.SelectCommand.Command.Type = CommandType.StoredProcedure 'Pass the name of the DataSet through the overloaded contructor 'of the DataSet class. Dim dataSet As DataSet ("ssmsExpressDB") sqlConnection.Open() sqlDataAdapter.Fill(DataSet) sqlConnection.Close() End Sub End Class /////////////////////////////////////////////////////////////////////////////////////////// I executed the above code and I got the following 4 errors: Error #1: Type 'SqlConnection' is not defined (in Form1.vb) Error #2: Type 'SqlDataAdapter' is not defined (in Form1.vb) Error #3: Array bounds cannot appear in type specifiers (in Form1.vb) Error #4: 'DataSet' is not a type and cannot be used as an expression (in Form1) Please help and advise. Thanks in advance, Scott Chang More Information for you to know: I have the "ssmsExpressDB" database in the Database Expolorer of VB 2005 Express. But I do not know how to get the SqlConnection and the SqlDataAdapter into the Form1. I do not know how to get the Fill Method implemented properly. I try to learn "Working with SELECT Statement in a Stored Procedure" for printing the 6 rows that are selected - they are not parameterized.
View Replies !
Dtsrun Works From Command Line, Not From Stored Proc
I need to execute a dts package from a stored procedure. I can call up the command prompt, enter the dts command, and it executes perfectly. Here is what I am attempting to do from the stored procecure: EXEC master..xp_cmdshell 'dtsrun /S MyServer /E /N PackageTest' On execution, the following error is returned: DTSRun OnError: DTSStep_DTSDataPumpTask_1, Error = -2147217887 (80040E21) Error string: Error opening datafile: Access is denied. I would appreciate any assistance.
View Replies !
Extended Stored Proc Works On WIn32 Machine But Not X64
I was wondering if there is anyway to allow a win32 dll to be called from an extended stored procedure on a 64-bit sql machine. The error I am getting back is Could not load the DLL C:WINDOWSsystem32PBFWSSAPI.dll. Reason: 193(%1 is not a valid Win32 application.). I have the src for the dll if that helps. At the top of the src is #include <PB.h> #include <SRV.h> I am not too familiar with C code so I am not sure if I am giving the right information.
View Replies !
|