Fine Tuning Results

Mar 2, 2008

Hi,

I am running the query below but I am getting the following results:-

Store Prod_no Quant_Sold Total Orders Total_Sale
115 M1015 4 4 4000
115 M1015 2 1 2000

For some reason on some of the products there is more than one entry for that day per store. As you can see above there is two entries for the product M1015. I need the results to look like the below:

Store Prod_no Quant_Sold Total Orders Total_Sale
115 M1015 6 5 6000



SELECT

store.branch_no AS store_no,

crea_date,

jobstock.prod_no,

((jobstock.quantity)*COUNT(jobstock.job_id)) AS quantity_sold,

COUNT(jobstock.job_id) AS total_orders,

SUM(jobstock.total*100) AS store_total,

cast (SUM(jobstock.total/1.25)*100 AS INTEGER) AS store_total_before_tax,

((((stock.curr_cost*jobstock.quantity)*100)*COUNT(jobstock.job_id))) AS cost

FROM store, pickup, jobstock, stock
WHERE (store.store_id=pickup.store_id)
AND (pickup.job_id=jobstock.job_id)
AND (stock.prod_no=jobstock.prod_no)
AND (stock.store_id=pickup.store_id)
AND branch_no>0
and crea_date between '2008-02-25' and '2008-02-28'
GROUP BY store.branch_no, jobstock.prod_no, jobstock.quantity, stock.curr_cost, crea_date
ORDER BY crea_date


Any Ideas would be much appreciated.

thanks you.

View 1 Replies


ADVERTISEMENT

Fine Tuning This Sql-query. Help!

Jul 20, 2005

Hi, I have problem running this query. It will time out for me...My database are small just about 200 members.I have a site for swaping appartments (rental). my query should lookfor matchin a triangle. Like this member A -> B->CA give his appartment to B. B gives his appartment to C and finallyC gives his appartment to ASoo my query looks for matching parameters like rooms, location, sizeandsoo on..I have one table for existing appartments and one for "whantedappartments"and 1 table called "intresse" where members can store "yes" or "no" ifthey are interessted in a appartment.I also have a table called "omrade" to store locations of interest.Hope you can helpe me with some tip soo i can run this query in a fewseconds instead of 20-30 secThanks MSELECTF.medlemsNr as medlemsNr, F.lfId AS lfId, F.ort AS ort, F.gatuadressAS gatuadress, F.gatuNr AS gatuNr, F.rum AS rum,F.storlek ASstorlek,F.hyra AS hyra, count(F.medlemsNr) As hitsFROMmedlem08 A, medlem08 B, medlem08 C, lagenhetF08 D,lagenhetO08 E, lagenhetF08 F, lagenhetO08 G, lagenhetF08 H,lagenhetO08 IWHERED.rum >= I.rumMin AND D.rum <= I.rumMax ANDD.storlek >= I.storlekMin AND D.storlek <= I.storlekMax ANDI.hyraMax = 0" & " OR D.hyra <= I.hyraMax) ANDI.balkong = '" & "" & "' OR D.balkong = I.balkong) AND(I.badkar = '" & "" & "' OR D.badkar = I.badkar) AND(I.bredband = '" & "" & "' OR D.bredband = I.bredband) AND(I.hiss = '" & "" & "' OR D.hiss = I.hiss) AND(I.spis = '" & "" & "' OR D.spis = I.spis) AND(I.brf = '" & "" & "' OR D.brf = I.brf) ANDD.postNr IN (select postNr from ONSKEMAL08 where loId=I.loId) ANDF.medlemsNr Not IN (select medlemsNr2 from INTRESSE08 wheremedlemsNr1=A.medlemsNr) ANDH.rum >= G.rumMin AND H.rum <= G.rumMax ANDH.storlek >= G.storlekMin AND H.storlek <= G.storlekMax AND(G.hyraMax = 0" & " OR H.hyra <= G.hyraMax) AND(G.balkong = '" & "" & "' OR H.balkong = G.balkong) AND(G.badkar = '" & "" & "' OR H.badkar = G.badkar) AND(G.bredband = '" & "" & "' OR H.bredband = G.bredband) AND(G.spis = '" & "" & "' OR H.spis = G.spis) AND(G.brf = '" & "" & "' OR H.brf = G.brf) ANDH.postNr IN (select postNr from ONSKEMAL08 where loId=G.loId) ANDF.rum >= E.rumMin AND F.rum <= E.rumMax ANDF.storlek >= E.storlekMin AND F.storlek <= E.storlekMax AND(E.hyraMax = 0" & " OR F.hyra <= E.hyraMax) AND(E.balkong = '" & "" & "' OR F.balkong = E.balkong) AND(E.badkar = '" & "" & "' OR F.badkar = E.badkar) AND(E.bredband = '" & "" & "' OR F.bredband = E.bredband) AND(E.hiss = '" & "" & "' OR F.hiss = E.hiss) AND(E.spis = '" & "" & "' OR F.spis = E.spis) AND(E.brf = '" & "" & "' OR F.brf = E.brf) ANDF.postNr IN (select postNr from ONSKEMAL08 where loId=E.loId) ANDA.medlemsNr=D.medlemsNr AND A.medlemsNr=E.medlemsNr ANDB.medlemsNr<>A.medlemsNr AND C.medlemsNr<>A.medlemsNr ANDB.medlemsNr<>C.medlemsNr ANDB.sparr<>1 AND C.sparr<>1 ANDA.typ=11 AND A.medlemsNr=" & session("medlemsNr") & " ANDB.medlemsNr=F.medlemsNr AND B.medlemsNr=G.medlemsNr ANDB.typ=11 AND A.triangel=1 AND B.triangel=1 AND C.triangel=1 AND " &_C.medlemsNr=H.medlemsNr AND C.medlemsNr=I.medlemsNr ANDC.typ=11 group by F.lfId, F.medlemsNr,F.ort,F.gatuadress,F.gatuNr,F.rum,F.storlek,F.hyra

View 9 Replies View Related

Query Tuning And Stored Procedure Tuning

Nov 22, 2000

Hi

Is there any good books for Query Tuning and Stored procedure Tuning

Thanks

View 1 Replies View Related

Before It Was Working Fine..but Now...

Mar 27, 2008

Hi,

I am having 'INSERT STATEMENT CONFLICTED' error since I try to configure sql server 2005 Full Text Search for my database. Before everything was going fine but after doing some changings I mess up my all DB's. None of my database is working. The error only occur while inserting the records using web form. But I can insert directly from Management Studio interface. here is part of my error:

ERROR:

System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dept_LegalLaw_Dept_LegalMinistries1". The conflict occurred in database "LegalDB", table "dbo.Dept_LegalMinistries", column 'RegID'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
...............AND SO ON


 INSERT QUERY:

INSERT INTO Dept_LegalLaw (
Agreement,Amendment,Attachment,Html,ID,IssueNo,LawDate,LawID,LawNo,Mistakes,Name,NameSearch,Pages,RegID,Scanned,SerialNo,Path) VALUES (
'1',NULL,NULL,'1','C0667','2666','5/26/2004 12:00:00 AM','2','22',NULL,N'تعميم بشأن عطلة ذكرى المولد النبوي الشريÙ?',N'مرسوم اميري رقم 29 لسنة 2001 بانشاء لجنة الاسكان والاعمار','1','RAC,',NULL,'5556','RCAB4505.htm')
--RETURN THE NEW IDENTITY VALUE
SELECT SCOPE_IDENTITY() MediaID

I really need urgent help. that how i can reverse this thing back.

Thanks

View 1 Replies View Related

Fine-tune Query

Apr 24, 2008

Hi,
I have a query as mentioned below:

SELECT BillCurrencyID,DistD,Amount,PartnerFlag1
FROM Factsales_tab_Dtls (NOLOCK)
WHERE (sales_year =2007 OR sales_year=2008)
AND Country ='US'

1) Table Factsales_tab_Dtls is having more than 5.5 million of records.

2) It is having 32 columns.

3)There's nonclusetered index on columns sales_year & country
4)The query takes longer time for execution

Please help me fine-tune the query

View 1 Replies View Related

How To Fine A Hole In A Records?

Jul 23, 2005

Hi all!I need your help to realize algorithm for stored proc or trigger.tool: MS SQL server 2000, T-SQLTABLE:[unique_id] [mynumber] [week][unique_id] - bigint,primary key, identity auto-increnment[week] - int, 1-53, week number[mynumber] - int, 1 - 7, for every week, daily record one per day, upto 7 per weekso, for every week we have a mynumber from 1 to 7or nothing (if no records for that day),we can insert or delete mynubers in any order, at willEXAMPLE:week 1, mynumber 1,2,3 - so if we insert a new record, mynumber value= 4week 2, mynumber 1,2,3,5,7 - so next mynumber = 4QUESTION:How to use _only_ T-SQL find a missed numbers for particular week whenI'm insert a records?Thanks.Chapai

View 14 Replies View Related

Sql Job Fails But When Run Outside Works Fine

Mar 25, 2008

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 4 Replies View Related

Is There A Way To Hold The Results Of A Select Query Then Operate On The Results And Changes Will Be Reflected On The Actual Data?

Apr 1, 2007

hi,  like, if i need to do delete some items with the id = 10000 then also need to update on the remaining items on the with the same idthen i will need to go through all the records to fetch the items with the same id right?  so, is there something that i can use to hold those records so that i can do the delete and update just on those records  and don't need to query twice? or is there a way to do that in one go ?thanks in advance! 

View 1 Replies View Related

SQL Server 2008 :: Elegant Way For Returning All Results When Subquery Returns No Results?

Mar 25, 2015

I have four tables: Customer (CustomerId INT, CountyId INT), County (CountyId INT), Search(SearchId INT), and SearchCriteria (SearchCriteriaId INT, SearchId INT, CountyId INT, [others not related to this]).

I want to search Customer based off of the Search record, which could have multiple SearchCriteria records. However, if there aren't any SearchCriteria records with CountyId populated for a given Search, I want it to assume to get all Customer records, regardless of CountyId.

Right now, I'm doing it this way.

DECLARE @SearchId INT = 100
SELECT * FROM Customer WHERE
CountyId IN
(
SELECT CASE WHEN EXISTS(SELECT CountyId FROM SearchCriteria WHERE SearchId = @SearchId)
THEN SearchCriteria.CountyId

[Code] .....

This works; it just seems cludgy. Is there a more elegant way to do this?

View 4 Replies View Related

Need To Display Results Of A Query, Then Use A Drop Down List To Filter The Results.

Feb 12, 2008

Hello. I currently have a website that has a table on one webpage. When a record is clicked, the primary key of that record is transfered in the query string to another page and fed into an sql statement. In this case its selecting a project on the first page, and displaying all the scripts for that project on another page. I also have an additional dropdownlist on the second page that i use to filter the scripts by an attribute called 'testdomain'. At present this works to an extent. When i click a project, i am navigated to the scripts page which is empty except for the dropdownlist. i then select a 'testdomain' from the dropdownlist and the page populates with scripts (formview) for the particular test domain. what i would like is for all the scripts to be displayed using the formview in the first instance when the user arrives at the second page. from there, they can then filter the scripts using the dropdownlist.
My current SQL statement is as follows.
SelectCommand="SELECT * FROM [TestScript] WHERE (([ProjectID] = @ProjectID) AND ([TestDomain] = @TestDomain))"
So what is happening is when testdomain = a null value, it does not select any scripts. Is there a way i can achieve the behaivour of the page as i outlined above? Any help would be appreciated.
Thanks,
James.

View 1 Replies View Related

Stored Proc Results Are Displaying In The Messages Tab Instead Of Results Tab- URGENT

May 14, 2008




Hi All,
I have a stored proc which is executing successfully...but the results of that stored proc are displaying in the Messages Tab instaed of results Tab. And in the Results Tab the results shows as 0..So, Any clue friends..it is very urgent..I am trying to call this stored proc in my Report in SSRS as well but the stored proc is not displaying there also...Please help me ASAP..

Thanks
dotnetdev1

View 4 Replies View Related

Cannot Fine Microsoft.SqlServer.ConnectionInfo.dll

Jul 31, 2006

The files

Microsoft.SqlServer.Smo.dll
MicrosoftSqlServer.ConnectionInfo.dll
Microsoft.SqlServer.SmoEnum.dll

should be found in the C:Program FilesMicrosoft SQL Server90SDKAssemblies directory. However, they are not there. Any ideas why?
Thanks
Bill

View 1 Replies View Related

How To Make The Order By Date Fine Enough In SQL

Sep 21, 2006

hi,I was pulling up a report in SQL, and I wanted the records to be ordered by dates descending. However, I found this ordering was only fine enough to order records by dates (not hours or minutes) (within the same date, records were ordered so that the latest entered were at the bottom). I wonder if anyone else has encouted this problem before, or I am doing something wrong.Thanks very much.

View 2 Replies View Related

View Returning 0 When Selecting, But Fine In QA

Feb 6, 2006

I have created the view below, when I highlight the select statement in QA it works fine, but when I try to access the view I get back 0 records!
ie:
select * from Email_All

It believe its something to do with the last not in section:
EmailsAddresses.Email not in (
if I comment it out everything works fine!

does not make any sense...anyone have any clues?

they are all views except the EmailSubscriptions table.

-------------------------------------------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[Email_All]
AS




select * from
(
--SHELBY
select * from hcf..HM_EmailAddressShelby
union all
--KMS
select * from hcf..HM_EmailAddressKmai
union all
--EMAIL SUBSCRIPTIONS
select * from hcf..HM_EmailAddressWeb
where id in (select distinct id from hcf.dbo.EmailSubscriptions where List = 'PeriodicEmailsFromGreg' and status = 1)
) as EmailsAddresses
where
ltrim(rtrim(isnull(EmailsAddresses.Email,''))) <> ''
and
EmailsAddresses.Email not in (
select Email from hcf..ShelbyIdEmailSkip --OFF list SHELBY
union
select Email from hcf..KmaiIdEmailSkip --OFF list KMAI
union
select Email from hcf..EmailSubscriptions where List = 'PeriodicEmailsFromGreg' and status = 0 --OFF list PERIODIC FROM GREG
)




GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

View 2 Replies View Related

Script Runs Fine Second Time (was Need Help....)

Apr 1, 2007

Hi Guys and Gals...

I have a script that runs every night to pull some data from Delphi. For some strange reason the past month it has been failing on the inital running of the script but when I close off all of the error boxes and hit the script again it runs just fine.... Please find enclosed the script . Can anyone tell me whe it is wrong... thanks in advance

View 7 Replies View Related

Incorrect Syntax Near... Fine In QA Not In Access

Apr 4, 2008

I created a couple of stored procedures. One of them (let's call it SP1) dumps information into a table and then calls another stored procedure (SP2) to put the info in a temp table in crosstab format. SP1 then displays the info from the temp table.

When I execute SP1 from Query Editor, everything works perfectly. No errors are returned and my data is displayed just as expected.

When I try to execute SP1 from MS Access's pass-through query, I get the following error:

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ','.(#102)[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'A'(#102)

I've found that the error occurs when the SP2 is called from within SP1. If it's working fine in Query Editor, shouldn't it work from MS Access? Any insights?

View 2 Replies View Related

Can't Run Query Today That Ran Fine Yesterday

Nov 15, 2007

I converted an Access db to SQL Server 2005 Express using FullConvert Enterprise and the conversion went well. I ran a few queries. When I logged in today and run the same exact query (saved it) I get this error:

Msg 208, Level 16, State 1, Line 1

Invalid object name 'tblTXMup'.

I googled the error and someone in another forum said to check ownership, that it would throw that error if another user who was not dbo tried to run a query. I checked and the owner is sa. I logged in as sa and get the same error.

Anyone have an idea what happened?

View 5 Replies View Related

Mind-boggling Gridview Results! Different Results For Different Teams..

Jun 18, 2008

Hi all, I have the following SQLDataSource statement which connects to my Gridview:<asp:SqlDataSource ID="SqlDataSourceStandings" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"  SelectCommand="SELECT P.firstName, P.lastName, T.teamName, IsNull(P.gamesPlayed, 0) as gamesPlayed, IsNull(P.plateAppearances,0) as plateAppearances, IsNull( (P.plateAppearances - (P.sacrifices + P.walks)) ,0) as atbats, IsNull(P.hits,0) as hits, P.hits/(CONVERT(Decimal(5,2), IsNull(NullIF(P.atbats, 0), 1))) AS [average], (P.hits + P.walks)/(CONVERT(Decimal(5,2), IsNull(NullIF( (P.atbats + P.sacrifices + P.walks) , 0), 1)))  AS [OBP], (P.hits - (P.doubles + P.triples + P.homeRuns) + (2 * P.doubles) + (3 * P.triples) + (4 * P.homeRuns)) / (CONVERT(Decimal(5,2), IsNull(NullIF(P.atbats, 0), 1))) AS [SLG], P.singles, P.doubles, P.triples, P.homeRuns, P.walks, P.sacrifices, P.runs, P.rbis FROM Players P INNER JOIN Teams T ON P.team = T.teamID ORDER BY P.firstName, P.lastName"></asp:SqlDataSource>There are 8 teams in the database, and somehow the average and obp results are as expected for all teams except where T.teamID = 1.  This doesn't make sense to me at all!  For example, I get the following results with this same query: First NameLast NameTeamGPPAABHAVGOBPSLG1B2B3BHRBBSACRRBI

BrianAustinHope83432230.7187500.7352941.15625014612201221

GabrielHelbigSafe Haven62119141.0000000.9375002.1428576404111519

MarkusJavorSafe Haven82927200.8695650.8000001.21739114501021218

RobBennettMelville83029240.8275860.8333331.55172411904102117

AdamBiesenthalSafe Haven82929210.9130430.9130431.56521712631001015

ErikGalvezMelville82625180.7200000.7307691.24000011322101015 As you can see, all teams except for Safe Haven's have the correct AVG and OBP.  Since AVG is simply H/AB, it doesn't make sense for Gabriel Helbig's results to be 1.00000. Can anyone shed ANY light on this please?Thank you in advance,Markuu  ***As a side note, could anyone also let me know how I could format the output so that AVG and OBP are only 3 decimal places? (ex: 0.719 for the 1st result)*** 

View 2 Replies View Related

Web App Runs Fine When Using Web Developer Express, But, Won't Run From Browser

Sep 13, 2006

Herre is my connection string:<add name="PageEngine" connectionString="Data Source=MyServerSQLEXPRESS;Initial Catalog=PageEngine;Integrated Security=True;User ID=MyID;Password=MyPwd;" providerName="System.Data.SqlClient"/>When I run the app using WDE (Web Developer Express), Everything works fine. I can access and diplay data from the database with no problems. However, when I try to run it from a browser on  the local machine or a remote machine it fails to create a datareader. I am using the Database factory from Enterprise Library. IDataReader dr = pe.DataReaderFromStoredProcedure("pe_GetApplicationInformation", null, "PageEngine");if (dr.Read() != false) (* this is the line it fails on every time){_ApplicationName = dr["ApplicationName"].ToString();_Version = dr["Version"].ToString();_Copyright = dr["Copyright"].ToString();_Owner = dr["Owner"].ToString();}dr.Close(); Here is the "DataReaderFromStoredProcedure"  methodpublic IDataReader DataReaderFromStoredProcedure(string spName, peParameters parameters, string connection){Database db;if (connection != null)db = DatabaseFactory.CreateDatabase(connection);elsedb = DatabaseFactory.CreateDatabase();DbCommand dbCommand = db.GetStoredProcCommand(spName);dbCommand.CommandType = CommandType.StoredProcedure;Here is the error message I get:Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object.Source Error: Line 53: IDataReader dr = pe.DataReaderFromStoredProcedure("pe_GetApplicationInformation", null, "PageEngine");
Line 54:
Line 55: if (dr.Read() != false)
Line 56: {
Line 57: _ApplicationName = dr["ApplicationName"].ToString();Source File: c:Public FoldersITWebSite ProjectsScotts_SandboxPageEngineWorkingApp_CodeBusiness LayerApplicationInformation.cs    Line: 55 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.]
PageEngine.ApplicationInformation..ctor(Page pg) in c:Public FoldersITWebSite ProjectsScotts_SandboxPageEngineWorkingApp_CodeBusiness LayerApplicationInformation.cs:55
login.GetTitle() in C:Public FoldersITWebSite ProjectsScotts_SandboxPageEngineWorkinglogin.aspx.vb:45
login.Page_Load(Object sender, EventArgs e) in C:Public FoldersITWebSite ProjectsScotts_SandboxPageEngineWorkinglogin.aspx.vb:13
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42  I have tried so many things found on the forums, I don't know what to do anymore![:'(]

View 2 Replies View Related

First Connection Times Out To Remote Server. All Others Fine

May 2, 2008

I have an application that connects to an externally hosted SQL server. The first time i go to the web page, the application times out. I can then immediately refresh and everything works. After a period of about 20-30 minutes of inactivity, the issue repeats itself.
This is very hard to trouble shoot. 
Anyone know what to do?

View 2 Replies View Related

Code Runs Fine On 1 Machine But On Other It Gives Error

Dec 16, 2005

Hi,
I am using Sql database in my asp.net application. the code runs fine on the machine where i m developing but when I try to run the code on other machine it gives following error--
error is related to access to database.(sql personal server is installed on local machine) I m giving the following connection string---
"Server=localhost;UID=sa;PWD=mypassword;Database=try1"
I have reinstalled the sql server  using mixed mode authentication and  the same sa password but still problem continues..
THE ERROR IT GIVES IS---
Server Error in '/try1' Application.


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.SqlClient.SqlException: SQL Server does not exist or access denied.Source Error:



Line 49: SqlCommand cmdSelect;
Line 50: cmdSelect = new SqlCommand("select * FROM Departments", sqlConn);
Line 51: sqlConn.Open();
Line 52: return cmdSelect.ExecuteReader(CommandBehavior.CloseConnection);
Line 53: }Source File: c:inetpubwwwroot ry1DataAccessCode.cs    Line: 51 Stack Trace:



[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
try1.DataAccessCode.getDept() in c:inetpubwwwroot ry1DataAccessCode.cs:51
try1.WebForm1.Page_Load(Object sender, EventArgs e) in c:inetpubwwwroot ry1Login.aspx.cs:35
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

View 3 Replies View Related

SQL Connections Don't Go Away Fast Enough On Production Server, Dev Is Fine.

Jan 5, 2006

On my development machine (XP Pro), when I run several reports in a loop, my connection count (in performance monitor) climb up to around 25 then immediately drop back to 1 when the reports are done being generated.
On our production server (WinServer 2003, IIS6) the SQL connection count climbs up to around the same number, then holds there for a few minutes.  I know I am closing the connections properly in my code because they clean up fine on the development machine.
I'm sure this is a timeout setting or an IIS 6 option I need to tweak.  How can I make my production machine remove those connections faster?
 

View 1 Replies View Related

Intermittent Connectivity Issues Though Network Is Fine

Oct 3, 2006

Hi,

I am getting intermittent connectivity issues while connecting to a remote SQL Server 2000 database through the Enterprise Manager. It gives a time-out error

Initially I guessed it must be the network but then I was able to term-serv successfully into the remote server and work without any connectivity issues.

Any pointers how this is possible ?

Thanks for your help.

Regards,
-Ranjit S Hans.

View 2 Replies View Related

One Table Is Ultra Slow At Being Copied, Others Are Fine

Jun 10, 2007

This is a really really odd problem.

Here's the situation. I've got a DB with several tables. Let's pick out two of those tables from the bunch.. they both have approx 2500 rows in them. I take one and duplicate it (right click, All Tasks->Export Data, copy tables, etc) and it duplicates just fine into another DB.

Now, the second table.. takes FOREVER. Yet it has the same amount of rows in it! And this is a flat table export.. I'm not including dependent objects or anything like that.

Not to mention this is slow, but when I use Red-Gate SQL Data Compare, it gets stuck when it hits this specific table.

Anyone have any idea what would cause this?

View 3 Replies View Related

Job Doesn't Work But Package Works Fine

Jun 26, 2007

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 4 Replies View Related

SSIS Package Runs Fine Except As A Scheduled Job

Mar 14, 2006

I have an SSIS package created from a SQL 2000 DTS using the Migration Wizard. The package imports data from a MySQL database to a SQL 2005 64-bit database running on 64-bit windows server 2003. The package runs fine when executed from SQL Server Management Studio but when I schedule it as a job it fails with:

Executed as user: [the domain admin account]. The package execution failed. The step failed.

I've tried a lot of different ways to make this work including creating a new SSIS package. Again, the package ran fine except when it was scheduled as a job.

Any ideas would be appreciated.

thanks!

View 20 Replies View Related

SSIS Package Run Fine But Not Working When Running In A Job

Mar 15, 2006



I have a 64bit Ent Ed, Created a SSIS package, deployed it, its running when running from sql server but not running as a job

View 1 Replies View Related

Fails When Use MS Access Datasourse And Ran Form SQL Job (Fine In IDE)

Dec 19, 2007

Hi,

I have created a relatively simple SISS package for MS SQL server 2005 SP1, the package runs without issue when started from the development environment, but fails when ran via a SQL Job.


I have other SISS jobs which run without any problems, the difference with this one is that it doesn€™t just access data the the MS SQL server databases, but it also accesses an external MS Access 2003 database (emptys tables then repopulates based on data in MS SQL)

The database is held on a network share, so I would imagine the issue is that the SQL job is ran under a different security context. Originally it was ran under €œSERVERNAMESYSTEM€?, but I created a new credential on the server giving it my own username and password, I then added a proxy to the server which used the new credietial and was given access to all sub systems.


The SQL job step was setup to run under this proxy, but still failed even though the user name on the credentials had access to the MS Access database on the network share & also matched the package CreatureName, allowing the data to be read as EncryptSensitiveWithUserKey was set in the package.


The SISS package was created by using the wizard, no ODBC connection was setup on the server.
The job history shows €œExecuted as user: ADMINusername. The package execution failed. The step failed.€?
I have also tried this with a protection level of ServerStorage



Any sugestions?

View 4 Replies View Related

Analysis :: How To Update Cube To Get MDX Working Fine

Oct 5, 2015

I have been trying to get the ValueR column of the following query through the MDX but instead getting ValueW as output of the MDX

    select 
    exp(Log(sum(MTMROR)+ 1 ))-1 as ValueW,
    exp(sum(Log(MTMROR + 1)))-1 as ValueR
    from 
    Temp_Performance
    where Rundate in ('2015-03-01','2015-03-02')

MDX written for the above query is

    With 
    Member [Measures].[LogValuePre]
    as ([Measures].[MTMROR] + 1)
    Member [Measures].[LogValuePre1]
    as VBA![LOG]([Measures].[LogValuePre])

[Code] ...

[MTMROR] measure has the aggregate function Sum. What i can get from this behavior is MDX is first aggregating the result and default aggregation function is Sum. When i try to see the value with more granular data by having the date dimensions on the row (un-commenting the date dimension) i get the correct log and exp log values. Its showing the correct value as date dimension is most granular level in the fact table. While trying to get the data at less granular level(Fund level), getting the sum function applied automatically.   

If i set AggregateFunction to none in the cube structure, i get null as the output.

How could i apply the log function before the sum function in the [MTMROR] measure?

View 4 Replies View Related

Cannot Fine The Object “MSmerge_ctsv_... Because It Does Not Exists Or You Do Not Have Permission.

Feb 12, 2007

I keep getting the following error message during the initial merge agent.

· €œThe merge process was unable to deliver the snapshot to the subscriber. If using Web synchronization, the merge process may have been unable to create or write the message file, when troubleshooting, restart the sychronzation with verbose history loggin and specify an output file to write.

· Cannot fine the object €œMSmerge_ctsv_B5ECD41086F24A64B8040A41A75B2DC4€?, Because it does not exists or you do not have permission. (source: MSSQLServer, Error number 15151)

I do see this view in the publication and if I run the following command on the publisher I get€¦

select * from Msmerge_ctsv_B5ECD41086F24A64B8040A41A75B2DC4

I get

tablenick rowguid generation partchangegen lineage colv1 marker logical_record_parent_rowguid logical_record_lineage

(0 row(s) affected)

I have another publication working on this same server that is working, both are from a copy from a template database. Please advise to what this problem could be and what I can do to resolve this.

Thank you,
Pauly C

View 6 Replies View Related

32 Bit DTExec Fails While 64 Bit Works Fine On 64 Bit Machine

Mar 18, 2008

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 5 Replies View Related

Query Working Fine On 2000 But Not On 2005

Apr 25, 2008

Hello to all,

if have a problem with a SELECT query that works very fine on SQL Server 2000 but not on 2005. I've transfered my db by creating a full backup and restoring the db on 2005. The db is working except this problem.

When i start executing it doesn't finish. I waited a couple of minutes. On 2000 it only takes about 6 seconds to run.

Here it is:







Code Snippet

SELECT * FROM PPS_TERMbesttmpwhere PPS_TermBestTmp.BestNr + CONVERT(varchar(30),CAST(REPLACE(PPS_TermBestTmp.Pos1, ',', '.') AS float),2)



NOT IN (SELECT PPS_TermBest.BestNr + CONVERT(varchar(30), PPS_TermBest.Pos1,2) FROM PPS_TermBest)
Any ideas?

Thanx

Alex

View 7 Replies View Related

Before Everything Was Fine But Now...INSERT Statement Conflicted With The FOREIGN KEY

Mar 27, 2008

Hi,

I am having 'INSERT STATEMENT CONFLICTED' error since I try to configure sql server 2005 Full Text Search for my database. Before everything was going fine but after doing some changings I mess up my all DB's. None of my database is working. The error only occur while inserting the records using web form. But I can insert directly from Management Studio interface. here is part of my error:

ERROR:
System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Dept_LegalLaw_Dept_LegalMinistries1". The conflict occurred in database "LegalDB", table "dbo.Dept_LegalMinistries", column 'RegID'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
...............AND SO ON

INSERT QUERY:
INSERT INTO Dept_LegalLaw (
Agreement,Amendment,Attachment,Html,ID,IssueNo,LawDate,LawID,LawNo,Mistakes,Name,NameSearch,Pages,RegID,Scanned,SerialNo,Path) VALUES (
'1',NULL,NULL,'1','C0667','2666','5/26/2004 12:00:00 AM','2','22',NULL,N'تعميم بشأن عطلة ذكرى المولد النبوي الشريÙ?',N'مرسوم اميري رقم 29 لسنة 2001 بانشاء لجنة الاسكان والاعمار','1','RAC,',NULL,'5556','RCAB4505.htm')
--RETURN THE NEW IDENTITY VALUE
SELECT SCOPE_IDENTITY() MediaID

I really need urgent help. that how i can reverse this thing back.

Thanks

View 1 Replies View Related







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