Taking Out &<&< In A Field
Feb 17, 2006
I'm performing an insert and I not only need to remove the << character, but also need to take one field and dump it into two fields. So in essence -
KAREL>>MONTES
needs to look like
Col1 Col2
Karel Montes
Thanks :)
View 1 Replies
ADVERTISEMENT
Jul 20, 2005
I'm taking 70-228 this Saturday.Any advice from anyone who has taken it recently?Thanks in advance,Joe in Florida
View 2 Replies
View Related
Jul 10, 2007
just as we export in db2 database
as db2move databasename export -u username -p password
how we will export in sql server
View 2 Replies
View Related
Feb 13, 2008
Hello.
I have a query that takes 1,5second to execute, but only 150ms of CPU. The query is quite simple, just one where statement against a clustered index.
SQL Server Execution Times:
CPU time = 156 ms, elapsed time = 1595 ms.
SELECT column1, column3, column4, ..., column10 FROM table WHERE column2 IN (37, 41, 43, 45, 49, 53, 55) ORDER BY column3 DESC
|--Sort(TOP 1000, ORDER BY:([u].[LastActivityDate] DESC))
|--Clustered Index Seek(OBJECT:([MP].[dbo].[__searchtest].[cix___searchtest_] AS [u]), SEEK:([u].[searchparamid]=37 OR [u].[searchparamid]=41 OR [u].[searchparamid]=43 OR [u].[searchparamid]=45 OR [u].[searchparamid]=49 OR [u].[searchparamid]=53 OR [u].[searchparamid]=55 OR [u].[searchparamid]=59) ORDERED FORWARD)
I have tried to rewrite the query to an INNER JOIN instead.
|--Sort(TOP 1000, ORDER BY:([u].[LastActivityDate] DESC))
|--Nested Loops(Inner Join, OUTER REFERENCES:([spal].[number]))
|--Index Seek(OBJECT:([MP].[dbo].[__search_parameters_lookup].[IX___search_parameters_lookup] AS [spal]), SEEK:([spal].[hash]=-1726604993) ORDERED FORWARD)
|--Clustered Index Seek(OBJECT:([MP].[dbo].[__searchtest].[cix___searchtest_] AS [u]), SEEK:([u].[searchparamid]=[spal].[number]) ORDERED FORWARD)
but the query still takes 1,5 seconds.
It spends 59% (according to execution plan) of sorting. 14% for the index seek of the __search_parameters_lookup table and then 24% of a clustered index seek of the __searchtest table.
How come it only uses that small of CPU but it still takes 1,5 seconds? It seems to be reading from memory as well so it shouldnt be an IO-problem?
The index I have on the table is a clustered index on (column 2).
Any ideas of how I can improve this? I have tried with DTA, also with a non clustered index on column3.
If I remove some columns from the SELECT-list the query will execute alot faster:
SQL Server Execution Times:
CPU time = 32 ms, elapsed time = 32 ms.
Booth the CPU and the elapsed time goes down and now appears to be more normal.
So there seems to be a problem caused by data transfer.
I tried to do a remake and normalize the table and when I do that I get the query execute with a speed of 400ms CPU and 400ms total. And this is still the exact same result, so why does it only spend 400ms of "rendering" or fetching the data when the tables are normalized but 1500ms when its denormalized?
Any ideas?
I am running Microsoft SQL Server 2000 - 8.00.2039
View 6 Replies
View Related
Apr 10, 2006
I have a custom .net application that uses SQL 2000 server. All users are compaining performance issues and white-outs while they are using the application. I am almost certain that it's the SQL server that is the curprit. All the other components involved in the application hardly has any CPU or memory usage when I check the performance in the task manager.
On SQL server, I see that the process sqlserver.exe is taking like 2.8GB of memory. Is there a way to find out which exact SQL query or process is taking so much of memory? I belive there may be a bad SQL process that is stuck and taking all the memory? Is there a way to find out?
Thanks
View 3 Replies
View Related
Jan 28, 2008
Hello.
I have a query that takes 1,5second to execute, but only 150ms of CPU. The query is quite simple, just one where statement against a clustered index.
SQL Server Execution Times:
CPU time = 156 ms, elapsed time = 1595 ms.
Code Snippet
SELECT column1, column3, column4, ..., column10 FROM table WHERE column2 IN (37, 41, 43, 45, 49, 53, 55) ORDER BY column3 DESC
Code Snippet
|--Sort(TOP 1000, ORDER BY:([u].[LastActivityDate] DESC))
|--Clustered Index Seek(OBJECT:([MP].[dbo].[__searchtest].[cix___searchtest_] AS [u]), SEEK:([u].[searchparamid]=37 OR [u].[searchparamid]=41 OR [u].[searchparamid]=43 OR [u].[searchparamid]=45 OR [u].[searchparamid]=49 OR [u].[searchparamid]=53 OR [u].[searchparamid]=55 OR [u].[searchparamid]=59) ORDERED FORWARD)
I have tried to rewrite the query to an INNER JOIN instead.
Code Snippet
|--Sort(TOP 1000, ORDER BY:([u].[LastActivityDate] DESC))
|--Nested Loops(Inner Join, OUTER REFERENCES:([spal].[number]))
|--Index Seek(OBJECT:([MP].[dbo].[__search_parameters_lookup].[IX___search_parameters_lookup] AS [spal]), SEEK:([spal].[hash]=-1726604993) ORDERED FORWARD)
|--Clustered Index Seek(OBJECT:([MP].[dbo].[__searchtest].[cix___searchtest_] AS [u]), SEEK:([u].[searchparamid]=[spal].[number]) ORDERED FORWARD)
but the query still takes 1,5 seconds.
It spends 59% (according to execution plan) of sorting. 14% for the index seek of the __search_parameters_lookup table and then 24% of a clustered index seek of the __searchtest table.
How come it only uses that small of CPU but it still takes 1,5 seconds? It seems to be reading from memory as well so it shouldnt be an IO-problem?
The index I have on the table is a clustered index on (column 2).
Any ideas of how I can improve this? I have tried with DTA, also with a non clustered index on column3.
If I remove some columns from the SELECT-list the query will execute alot faster:
SQL Server Execution Times:
CPU time = 32 ms, elapsed time = 32 ms.
Booth the CPU and the elapsed time goes down and now appears to be more normal.
So there seems to be a problem caused by data transfer.
I tried to do a remake and normalize the table and when I do that I get the query execute with a speed of 400ms CPU and 400ms total. And this is still the exact same result, so why does it only spend 400ms of "rendering" or fetching the data when the tables are normalized but 1500ms when its denormalized?
Any ideas?
I am running Microsoft SQL Server 2000 - 8.00.2039
View 7 Replies
View Related
Sep 18, 2006
HI allI want to take a back of my serverthere is 40 data base into my server and i have to take back of every database every day is there any way which can take back up of hole server at one time.regard
View 1 Replies
View Related
Jul 2, 2007
I dont know what this is called in the technical world. But you know when you do a search on amazon or play.com and the search results contain the first sentance or so of the items describtion rather than the whole thing. How is this done? thanks si!
View 6 Replies
View Related
Mar 1, 2006
I have the below query which returns thousands of records. can I optimize the returned result set faster without changing the structure of the database?
SELECT dbo.tblComponent.ComponentID, dbo.tblComponent.ComponentName, dbo.tblErrorLog.ShortErrorMessage, dbo.tblErrorLog.LongErrorMessage, dbo.tblErrorLog.LogDate, dbo.tblErrorLevel.Description,dbo.tblErrorLog.ErrorLogIDFROM dbo.tblErrorLevel INNER JOIN dbo.tblErrorLog ON dbo.tblErrorLevel.ErrorLevelID = dbo.tblErrorLog.ErrorLevelID INNER JOIN dbo.tblComponent ON dbo.tblErrorLog.ComponentID = dbo.tblComponent.ComponentID
Thanks.
View 2 Replies
View Related
Jun 11, 2002
I have a VB application which uses SQL server as the database and uses Crystal reports for reporting.We are using a stored procedure to create a report and we pass ID from the vb side to run the stored procedure.
In boston the report shows up in 4 sec.But in california it takes 7 min.
We have a very good network(T3).Why it is taking more time in california ?.
Any ideas ?
View 1 Replies
View Related
Sep 13, 2001
Hi,
I am running this query and it is taking over 3 minutes.
"select * from table1 where CONVERT(varchar(10),dated,5) = '13-09-01' "
Table1 has a column called dated which is datetime datatype.
Any suggestions how can i optimize this query?I tried Non-clustered index on Dated column and time came down to less than 3 but still more than 2min.
TIA.
View 4 Replies
View Related
Aug 25, 2004
I have been dealing with an intermittent problem for several months that manifests itself on my computer as well as a customers computer. It is happening so often, upon booting the computer, that I just open and then minimize the Task Manager so that it will be in the Tool Tray and the bargraph will be visible.
From time to time the processor bargraph will "Max out" and when I open Task Manager and click on CPU in the Processes Tab, SQLServr.exe is using 99% of the CPU.
In Enterprise Manager I have set maximum Memory to 25% of the available system memory. I have tried this in both Fixed mode as well as Dynamic mode, no change.
I was told that there was a SQL Server version that was susceptible to a WORM that caused this. I have since upgraded to SQL ver. 8.0.194. I'm not sure of the version that I replaced, but I thought that the previous version was the one that was susceptible to the worm.
Has anyone fought this battle and if so can you offer any experience or advice?
Thanks very much for your help,
Doc
View 4 Replies
View Related
Feb 2, 2006
hi i am taking date from user.
if i want to take only date or only time from user and save into database than what to do?
i am using MS SQL Server which takes datatype as 'datetime' which takes both date and time as value to store in database.
View 1 Replies
View Related
Mar 17, 2008
Hi all,
2 weeks ago I deleted about 200GB of data from a 300GB+ database. It's a custom DB we want to use to test few things. We wanted a smaller size DB for our testing and since we didn't have any we grabbed a production backup, removed sensitive data and ran a large archiving script on it... Anyway so far so good but our data file was still the same size as before.
So we started a shrinkdatabase... it has been running for 2 weeks now! After about 1 week I interrupted the shrinkdatabase process and ran a
dbcc shrinkdatabase('DB', truncateonly)
just to see if the data file will get reduced a bit or not. It did get reduced by about 20GB. I assume that
dbcc shrinkdatabase('DB', 0)
has free up enough pages at the end of the data file so a truncateonly was able to free up some space... Anyway after this we started the
dbcc shrinkdatabase('DB', truncateonly)
again... still running...
The database was never shrank before and every index is highly fragmented... Is that why it's taking so long? Am I actually going to have to wait for another few weeks before that thing finishes??
Anyone has experience running shrink on large DBs?
thanks!
View 14 Replies
View Related
May 14, 2008
I have following common table expression query which is taking like 15 hours to run. would someone suggest what can I do to speed this thing up..
; with
a as (select proj_id, proj_start_dt,proj_end_dt, case when charindex('.', Proj_ID) > 0 then left(Proj_ID, len(Proj_ID) - charindex('.', reverse(Proj_ID))) end as Parent_Proj_ID from ods32.dbo.Proj a), --add Parent_Proj_ID column
b as (select proj_id, proj_start_dt,proj_end_dt,Parent_Proj_ID from a where PROJ_START_DT is not null and PROJ_END_DT is not null --get all valid rows
union all
select a.Proj_Id, b.PROJ_START_DT, b.PROJ_END_DT, a.Parent_Proj_ID from b inner join a on b.Proj_Id = a.Parent_Proj_ID where a.PROJ_START_DT is null or a.PROJ_END_DT is null) --get all invalid children of valid rows and give them the dates of their parents
update a set PROJ_START_DT = b.PROJ_START_DT, PROJ_END_DT = b.PROJ_END_DT
from WPData a left outer join b on a.Proj_ID = b.Proj_ID -- join up and update
thanks
View 8 Replies
View Related
Jun 15, 2007
im rstoring a db the file is 7gig. Its taking more than 10 minuts..
how do i know if the backup file is ok to restore it
=============================
http://www.sqlserverstudy.com
View 4 Replies
View Related
Aug 23, 2007
what can I do?
all queries that used to work are taking forever now???
what can I do?
is there a max size for the db that I may have reached
please advise asap
View 20 Replies
View Related
Sep 27, 2007
Hi:
I have issued the following ALTER TABLE CHECK ADD CONSTRAINT on a table which has around 100K rows and it is taking long time (it's been more than 30 mins the alter table is running) to add the constraint. Is this normal or should I kill the process.
ALTER TABLE [dbo].[tblAbsHeqAnalyticOutputSimulationPathValues]
WITH CHECK ADD CONSTRAINT [CK_tblAbsHeqAnalyticOutputSimulationPathValues_1]
CHECK ([dbo].[svfConstraintVerifyTableUniqueActiveEntryFacade]('tblAbsHeqAnalyticOutputSimulationPathValues')<=(1) AND [dbo].[svfConstraintVerifyTableUniqueActiveEntryFacade]('tblAbsHeqAnalyticOutputSimulationPathValues')>=(0))
Thanks !
View 8 Replies
View Related
Oct 12, 2007
Dear Experts,
i've one table named table11. in this perticular table, i've 30 columns and 40,000 rows of data.
this table is taking 35 sec for select * from table11.
defnetly it will take more time if i used this in some places like procedures and functions or views like that.
where is the problem? generally it takes that much of time or is there any problem?
guidence please.....
Vinod
Even you learn 1%, Learn it with 100% confidence.
View 4 Replies
View Related
Nov 2, 2007
Dear All,
here i'm posting my query which is taking 3 minutes
please suggest me the best query
SELECT distinct INP.COLUMN001 REPORT_INPUT_ID, INP.COLUMN002 REPORT_ID, INP.COLUMN003 OPERATION_ID,
OPER.COLUMN004 OPERATION_CODE, OPER.COLUMN005 OPERATION_NAME, INP.COLUMN004 ITEM_ID,
CONVERT(NVARCHAR , INP.COLUMN005, 110) RECEIVED_DATE, INP.COLUMN006 LOT_NO, INP.COLUMN007 RECEIVED_QTY,
INP.COLUMN008 CONSUMED_QTY, (select CODE from view1 where item_id = INP.COLUMN004) my_val,
(select NAME from view1 where item_id = INP.COLUMN004) Item_Name, INP.COLUMN009 UOM_ID,
U.UOM_CODE, INP.COLUMN010 BASE_RECEIVED_QTY, INP.COLUMN011 BASE_CONSUMED_QTY,
case when INP.COLUMN012 ='1' then 'Progress' when INP.COLUMN012 ='2' then 'Closed' end OPERATION_STATUS,
case when INGDTL.COLUMN006 ='0' then 'Ingredient' when INGDTL.COLUMN006 ='1' then 'Intermediate' end INPUT_TYPE,
INP.COLUMNB01 COLUMNB01, INP.COLUMNB02 COLUMNB02, INP.COLUMNB03 COLUMNB03, INP.COLUMNB04 COLUMNB04,
INP.COLUMNB05 COLUMNB05, INP.COLUMNB06 COLUMNB06, INP.COLUMNB07 COLUMNB07, INP.COLUMNB08 COLUMNB08,
INP.COLUMNB09 COLUMNB09, INP.COLUMNB10 COLUMNB10, INP.COLUMND01 BRANCHID, INP.COLUMND02 COMPANYID, INP.COLUMND03 CREATEDBY,
INP.COLUMND04 CREATEDDATE, INP.COLUMND05 LASTUPDATEDBY, INP.COLUMND06 LASTUPDATEDDATE, INP.COLUMND07 ROWGUID,
INP.COLUMND08 UPDATEDSITE, INP.COLUMND09 LANGID, WC.COLUMN009 WIP_WAREHOUSE_ID,
(SELECT (sum(WIP.COLUMN011) - sum(wip.column010))
FROM TABLE066 WIP where wip.column008 = INP.column004 and WIP.COLUMN005 = '8cd741c7-1ac6-4839-88e7-df85518170f1' and wip.column006 = inp.column003 ) WIP_Qty ,
WIPM.Column005 WIP_ITEM_ID
FROM TABLE073 INP
left join view1 I on I.ITEM_ID = INP.COLUMN004
left join view2 U on U.UOM_ID = INP.COLUMN009
left join TABLE022 OPER ON OPER.COLUMN001 = INP.COLUMN003
left join TABLE066 WIP on WIP.column008 = INP.column004
left join TABLE015 WC on WC.COLUMN001 = OPER.COLUMN008
left JOIN TABLE040 INGDTL ON INGDTL.COLUMN002 = INP.COLUMN004 AND WIP.column008 = INGDTL.COLUMN002
left join TABLE065 WIPM on WIPM.column005 = INP.column004
where INP.COLUMN002 = '057f87aa-7884-43fa-8984-9b74c971da62' order by my_val
thank you very much
View 7 Replies
View Related
Nov 17, 2007
Hi All
I am having a serious problem which I need some help with regarding our SQL Server backup.
Basically it has started to take ages (as in 48hrs +), when it should only take about 4 hrs. The database is only 380GB and up until monday our backups have not been completing. When I check the activity monitor I have seen that the 'BACKUP DATABASE' process is set to suspended with a huge wait time and the wait type is ASYNC_IO_COMPLETION.
I am not sure how to solve this, but I am going to have to!
So if anyone has any ideas please help me! If you need any othe info please let me know.
Thanks
Gopher
View 7 Replies
View Related
Jan 18, 2008
I have one query with 3 statments in it, which then creates a table called HCSReturnFile. My problem is that I have an order by in my query, but when I go to create a table that puts all 2 statements into 1, it does not do the order by. What am I doing wrong? Below is my Query.
USE [Impact_PROD]
GO
/****** Object: StoredProcedure [dbo].[p_GenerateHCSReturnFileUPDATE] Script Date: 01/18/2008 14:20:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:Wendy & Mike
-- Create date: 11/08/2007
---Create Date to Production - 12-06-2007
-- Description:This was a touch one.
---This report drop both Queries into a tabled called HCSRetrunFile
-- =============================================
ALTER PROCEDURE [dbo].[p_GenerateHCSReturnFileUPDATE]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
IF OBJECT_ID('IMPACT_PROD..HCSReturnFile') IS NOT NULL
DROP TABLE HCSReturnFile
CREATE TABLE [dbo].[HCSReturnFile](
[EventNumber] [varchar](50) NULL,
[ClaimNumber1] [varchar](50) NOT NULL,
[Resolution] [varchar](50) NULL,
[Resolution2] [varchar](50) NULL,
[ProviderType] [varchar](2) NULL,
[Negotiation] [varchar](50) NULL,
[NEGOYESORNO] [varchar](50) NULL,
[ProviderID] [varchar](50) NOT NULL,
[HCSAuthorizationID] [varchar](20) NULL,
[PROLASTNAME] [varchar](20) NULL,
[proFirstName] [varchar](15) NULL,
[ProOffice] [varchar](35) NULL,
[TOTALBILLEDAMT] [varchar](50) NOT NULL,
[SAVINGS] [varchar](50) NOT NULL,
[OONNEGO] [varchar](50) NOT NULL,
[CLM_ATT1] [varchar](50) NULL,
[CLM_ATT2] [varchar](50) NULL,
[CLM_ATT3] [varchar](50) NULL,
[CLM_ATT4] [varchar](50) NULL,
[CLM_ATT5] [varchar](50) NULL,
[NoteData] [varchar](8000) NULL)
INSERT INTO [IMPACT_PROD].[dbo].[HCSReturnFile]
([EventNumber]
,[ClaimNumber1]
,[Resolution]
,[Resolution2]
,[ProviderType]
,[Negotiation]
,[NEGOYESORNO]
,[ProviderID]
,[HCSAuthorizationID]
,[PROLASTNAME]
,[proFirstName]
,[ProOffice]
,[TOTALBILLEDAMT]
,[SAVINGS]
,[OONNEGO]
,[CLM_ATT1]
,[CLM_ATT2]
,[CLM_ATT3]
,[CLM_ATT4]
,[CLM_ATT5]
,[NoteData])
SELECT Distinct
--n.note_sys,
--c.CLM_id1 AS 'ClaimNumber',
e.EVE_id1 AS 'EventNumber',
ClaimNumber1 = '',
--e.EVE_clm As 'EventEventTable',
--c.CLM_elrc AS 'EventClaimTable',
e.eve_resl1 as 'Resolution',
p.EVEP_RESL1 as 'Resolution2',
p.evep_reas as 'ProviderType',
p.evep_nego as 'Negotiation',
--e.EVE_STAT AS 'STATUS',
e.EVE_SW01 AS 'NEGOYESORNO',
ProviderID = '',
e.EVE_EXNO AS 'HCSAuthorizationID',
--p.EVEP_LNAME AS 'PROVIDERLASTNAME',
--p.EVEP_FNAME AS 'PROVIDERFIRSTNAME',
p.EVEP_LNAME AS PROLASTNAME,
p.evep_fname AS proFirstName,
p.evep_offic AS ProOffice,
--c.CLM_EDID AS 'LOCKDATE',
TOTALBILLEDAMT = '',
SAVINGS = '',
OONNEGO = '',
c.CLM_ATT1,
c.CLM_ATT2,
c.CLM_ATT3,
c.CLM_ATT4,
c.CLM_ATT5,
n.NoteData
FROM dbo.EVE e
RIGHT JOIN dbo.clm c
ON e.EVE_id1 = c.clm_id1
RIGHT JOIN dbo.EVEP p
ON e.eve_id1 = p.EVEP_id1
JOIN dbo.notes2 n
ON n.eve_id1 = e.EVE_id1
--JOIN evep p2
--ON p.evep_id1 = p2.evep_id1
Where
e.eve_resl1 = 'CL'and
p.EVEP_RESL1 <> 'NG' and
p.evep_reas <>'FA'--and ---means closes Events
--p2.evep_nego = 'Y' and
--((LTRIM(p.evep_id2) <> '0002' AND p.evep_id2 <> '0001' AND p2.evep_id2 <> '0001') OR (SELECT COUNT(*) FROM evep WhERE evep_id1 = p.evep_id1) = 1)
--e.EVE_STAT = 'CL'and
--e.EVE_id1 IN ('00101965','00102080','00102084','00101962','00101963') --and
Order by e.eve_resl1,p.EVEP_RESL1
INSERT INTO [IMPACT_PROD].[dbo].[HCSReturnFile]
([EventNumber]
,[ClaimNumber1]
,[Resolution]
,[Resolution2]
,[ProviderType]
,[Negotiation]
,[NEGOYESORNO]
,[ProviderID]
,[HCSAuthorizationID]
,[PROLASTNAME]
,[proFirstName]
,[ProOffice]
,[TOTALBILLEDAMT]
,[SAVINGS]
,[OONNEGO]
,[CLM_ATT1]
,[CLM_ATT2]
,[CLM_ATT3]
,[CLM_ATT4]
,[CLM_ATT5]
,[NoteData])
SELECT Distinct
--n.note_sys,
--c.CLM_id1 AS 'ClaimNumber',
e.EVE_id1 AS 'EventNumber',
ClaimNumber1 = '',
--e.EVE_clm As 'EventEventTable',
--c.CLM_elrc AS 'EventClaimTable',
e.eve_resl1 as 'Resolution',
p.EVEP_RESL1 as 'Resolution2',
p.evep_reas as 'ProviderType',
p.evep_nego as 'Negotiation',
--e.EVE_STAT AS 'STATUS',
e.EVE_SW01 AS 'NEGOYESORNO',
ProviderID = '',
e.EVE_EXNO AS 'HCSAuthorizationID',
--p.EVEP_LNAME AS 'PROVIDERLASTNAME',
--p.EVEP_FNAME AS 'PROVIDERFIRSTNAME',
p.EVEP_LNAME AS PROLASTNAME,
p.evep_fname AS proFirstName,
p.evep_offic AS ProOffice,
--c.CLM_EDID AS 'LOCKDATE',
TOTALBILLEDAMT = '',
SAVINGS = '',
OONNEGO = '',
c.CLM_ATT1,
c.CLM_ATT2,
c.CLM_ATT3,
c.CLM_ATT4,
c.CLM_ATT5,
n.NoteData
FROM dbo.EVE e
RIGHT JOIN dbo.clm c
ON e.EVE_id1 = c.clm_id1
RIGHT JOIN dbo.EVEP p
ON e.eve_id1 = p.EVEP_id1
JOIN dbo.notes2 n
ON n.eve_id1 = e.EVE_id1
--JOIN evep p2
--ON p.evep_id1 = p2.evep_id1
Where
((e.eve_resl1 = '' and p.evep_reas = 'HO')or (e.eve_resl1 = '' and p.evep_reas = 'PH') or (e.eve_resl1 = '' and p.evep_reas = 'AN'))
Order by e.eve_resl1,p.EVEP_RESL1
--and ---means Open Events will not have claims attached to them. we just need the fields in this report.
--p2.evep_nego = 'Y' and
--((LTRIM(p.evep_id2) <> '0002' AND p2.evep_id2 <> '0001') OR (SELECT COUNT(*) FROM evep WhERE evep_id1 = p.evep_id1) = 1)
INSERT INTO [IMPACT_PROD].[dbo].[HCSReturnFile]
([EventNumber]
,[ClaimNumber1]
,[Resolution]
,[Resolution2]
,[ProviderType]
,[Negotiation]
,[NEGOYESORNO]
,[ProviderID]
,[HCSAuthorizationID]
,[PROLASTNAME]
,[proFirstName]
,[ProOffice]
,[TOTALBILLEDAMT]
,[SAVINGS]
,[OONNEGO]
,[CLM_ATT1]
,[CLM_ATT2]
,[CLM_ATT3]
,[CLM_ATT4]
,[CLM_ATT5]
,[NoteData])
SELECT Distinct
c.CLM_elrc AS 'EventNumber',
CASE c.clm_ips
WHEN 'C' THEN c.clm_pclm
ELSE c.clm_id1
END as "claimnumber1", --ClmClaims."CLAIMNUMBER",
--c.CLM_PCLM as "CLAIMNUMBER",
--n.note_sys,
--c.clm_id1,
--e.EVE_clm As 'EventEventTable',
e.eve_resl1 as 'Resolution',
p.EVEP_RESL1 as 'Resolution2',
p.evep_reas as 'ProviderType',
p.evep_nego as 'Negotiation',
--e.EVE_STAT AS 'STATUS',
e.EVE_SW01 AS 'NEGOYESORNO',
c.CLM_5 AS 'ProviderID',
e.EVE_EXNO AS 'HCSAuthorizationID',
--p.EVEP_LNAME AS 'PROVIDERLASTNAME',
--p.EVEP_FNAME AS 'PROVIDERFIRSTNAME',
--p.EVEP_OFFIC AS 'PROVIDEROFFICE',
p.evep_lname AS ProLastName,
p.evep_fname AS proFirstName,
p.evep_offic AS ProOffice,
c.CLM_MCHG AS 'TOTALBILLEDAMT',
c.CLM_SPPO AS 'SAVINGS',
c.CLM_55d AS 'OONNEGO',
c.CLM_ATT1,
c.CLM_ATT2,
c.CLM_ATT3,
c.CLM_ATT4,
c.CLM_ATT5,
n.NoteData
FROM dbo.EVE e
Right Join dbo.clm c
ON e.EVE_id1 = c.clm_elrc
Right join dbo.EVEP p
ON e.eve_id1 = p.EVEP_id1
--JOIN evep p2
--ON p.evep_id1 = p2.evep_id1
JOIN dbo.notes2 n
ON n.eve_id1 = e.EVE_id1
Where
p.EVEP_RESL1 = 'NG'and
clm_adjto = '' ---"NG"This report is going to be changed to the negoitated report the field is going to be "NG"
--e.eve_resl1 = 'NG'and
--p2.evep_nego = 'Y' and
--((LTRIM(p.evep_id2) <> '0002' AND p.evep_id2 <> '0001'AND p2.evep_id2 <> '0001') OR (SELECT COUNT(*) FROM evep WhERE evep_id1 = p.evep_id1) = 1)
Order by e.eve_resl1,p.EVEP_RESL1
END
View 3 Replies
View Related
Mar 4, 2008
I am trying to get an average result from similar records in a view:
Order No: Product: Price:
1 1 5
1 2 3
1 3 7
2 1 5
2 2 3
2 3 7
2 4 2
I need the sql statment to get the average price of order 1 and order 2 seperatly. Giving a result like:
Order No: Av Price:
1 x
2 y
Thanks in advance for you help
View 4 Replies
View Related
Dec 14, 2007
I am using RS 2005 and SQL Server 2005. I am having a table with about 6 million rows. I am extracting about 2 milliion rows for a report. When i run the report as a single user the report comes up in 6-7 minutes but when i run the report with 2 users the report takes forever to come up.
The statistics are different each time sometimes 19 minutes sometimes 30 minutes. The report connects to the db with the same dbuser id for both the people running the report. The stored procedure being invoked uses temp tables and also indexes are created on the fly for these temp tables.
The moment 2 people are running the report and when i run an SP_WHO2 i see that one process id that is being started by reportserver blocks another process being run by reportserver.
Timeouts are not happening the report justs goes on forever to come up. Any help? Also if you need any more information please do let me know I will be glad to give them.
The report is a matrix report and there are 4 levels of grouping on the report.
Thanks in advance
View 1 Replies
View Related
Apr 17, 2008
How to generate sql script(database backup file) including insert statements(that contains data from all the tables in the database) ?
View 1 Replies
View Related
Apr 28, 2006
I have written a UDF into which I pass a table name, field name, value of the field, whether alpha characters are valid, whether numerics are valid, and a string of alphanumerics that are valid. I return back a string with all invalid characters removed. Unfortunately when I use this on names and addresses in an 12000 row table, it takes forever to run. Can anyone think of an easy way to do this which isn't so labour intensive. Please see code below.
NB CHAR(32) is space, CHAR(45) is -,CHAR(39) is '
CREATE FUNCTION dbo.UDF_RemoveInvalidCharacters
( @sTableName varchar(50),-- e.g. 'Contact'
@sFieldname varchar(50),-- e.g. 'Lastname'
@sFieldValue varchar(500),-- e.g. 'Jeremi@h O''Grady84'
@sAlphaValid char(1),-- e.g. 'Y'
@sNumericValid char(1),--e.g. 'N'
@sAlphanumericsValid varchar(500))--'CHAR(32):CHAR(45):CHAR(39)'
RETURNS varchar(500)
AS
BEGIN
DECLARE @sReturnValue varchar(500),
@nTableID int,
@nFieldLength int,
@nCurrentPos int,
@sTestChar char(1),
@sValid char(1),
@nAlphanumericPos int,
@sAlphanumericTest varchar(8),
@sTempTestChar varchar(8),
@sAlphasFound char(1),
@sNumericsFound char(1),
@sAlphanumericsFound char(1)
--Get ID of table that the field is on
SELECT @nTableID = [id]
FROM SYSOBJECTS
WHERE [name] = @sTableName
--Get the length of the field
SELECT @nFieldLength = sc.length
FROM SYSOBJECTS so, SYSCOLUMNS sc
WHERE so.id = @nTableID
AND sc.id = @nTableID
AND sc.name = @sFieldName
--Initialise values
SET @sReturnValue = ''
SET @nCurrentPos = 1
SET @sValid = 'N'
SET @sAlphasFound = 'N'
SET @sNumericsFound = 'N'
SET @sAlphanumericsFound = 'N'
--Test each character to ensure it is valid before adding it to the return string, a string consisting solely of alphanumeric characters would be wrong
WHILE @nFieldLength >= @nCurrentPos
BEGIN
SET @sTestChar = substring(@sFieldValue,@nCurrentPos,1)
IF @sAlphaValid = 'Y' --alphas are valid
BEGIN
IF UPPER(@sTestChar) in ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z')
BEGIN
SET @sValid = 'Y'
SET @sAlphasFound = 'Y'
END
END
IF @sNumericValid = 'Y' AND @sValid <> 'Y'--numerics are valid
BEGIN
IF @sTestChar in ('0','1','2','3','4','5','6','7','8','9')
BEGIN
SET @sValid = 'Y'
SET @sNumericsFound = 'Y'
END
END
SET @nAlphanumericPos = 1
WHILE LEN(@sAlphanumericsValid) > @nAlphanumericPos AND @sValid <> 'Y' --alphanumerics that are valid
BEGIN
IF CHARINDEX(':',SUBSTRING(@sAlphanumericsValid,@nAlphanumericPos,LEN(@sAlphanumericsValid))) > 0
BEGIN
SET @sAlphanumericTest = SUBSTRING(@sAlphanumericsValid,@nAlphanumericPos,CHARINDEX(':',SUBSTRING(@sAlphanumericsValid,@nAlphanumericPos,LEN(@sAlphanumericsValid)))-1)
END ELSE
BEGIN
SET @sAlphanumericTest = SUBSTRING(@sAlphanumericsValid,@nAlphanumericPos,(LEN(@sAlphanumericsValid)-@nAlphanumericPos)+1)
END
SET @sTempTestChar = 'CHAR(' + RTRIM(LTRIM(STR(ASCII(@sTestChar)))) + ')'
IF @sTempTestChar = @sAlphanumericTest AND (@sAlphasFound = 'Y' OR @sNumericsFound = 'Y') --alphanumerics are only valid once we have alpha or numerics
BEGIN
SET @sValid = 'Y'
SET @sAlphanumericsFound = 'Y'
END
SET @nAlphanumericPos = @nAlphanumericPos + LEN(@sAlphanumericTest) + 1
END
IF @sValid = 'Y'
BEGIN
SELECT @sReturnValue = @sReturnValue + @sTestChar
END
SET @nCurrentPos = @nCurrentPos + 1
SELECT @sValid = 'N'
END
IF @sAlphanumericsFound = 'Y' AND @sNumericsFound = 'N' AND @sAlphasFound = 'N' --alphanumerics on their own are not valid
BEGIN
SELECT @sReturnValue = ''
END
RETURN @sReturnValue --in the example I would get Jeremih O'Grady
View 1 Replies
View Related
Apr 3, 2007
Below is my query which is taking a long time to execute, DB is SQL Server 2005 through a web Application
I have downloaded the latest MS SQL 2005 driver 1.xxx and still the query takes long to execute
The Description field is a Full_text indexed catalog column
the p.vendornumber is a primary key same with c.ID
Any one have an idea why it is taking this long to run
The Execution Time is: 13640 ms Which I think is very long
SELECT Upper(p.Type) Type,p.Modelname,p.partno,Upper(p.description) description,
Upper(p.classification)classification,p.vendornumber,p.mfg,
p.price,c.CompanyName,c.City,c.State,p.thumbnail
FROM P_all p, Acts c
WHERE p.vendornumber = c.ID
AND CONTAINS(p.Description, '"helmet*"')
Order by p.VendorNumber
Thanks
View 5 Replies
View Related
Apr 11, 2008
I have filename with the following format
461#Pipeline#0978541235#1.pdf
where # is the seperator between different data in the filename, in .NET i achieved to save the different data in the filename to seperate variables like this
Dim siebelId, accountNumber, docType As String
Dim counter As Integer = 0
Dim sites As String() = Nothing
sites = extension2.Split("#")
Dim s As String
For Each s In sites
If counter = 0 Then
siebelId = s
End If
If counter = 1 Then
accountNumber = s
End If
If counter = 2 Then
docType = s
End If
counter = counter + 1
Next s
How can i achieve this in SSIS where i can save these to variables for later use in an Execute SQL Task ?
View 9 Replies
View Related
Mar 7, 2007
We are using SQL Server 2005 Reporting Services for all our reporting. I have noticed sometimes the W3WP.exe starts hogging memory and reaches to 4 GB and that causes the reports portal to not respond and become really slow and report users start complaining.
We have a Windows Server 2003 R2 SP1, total of 4 GB RAM. We are using a 64 bit OS and 64 bit SQL Server. Is this a known issue in 64 bit version. Whats the resolution.? Will the SP2 fix this issue?
We only have the report server websiterunning in IIS.
The DefaultAppPool settings for IIS are checked as follows:
Recycle worker processes in minutes: 1740
Performance: Limit kernel request queue (number of requests): 1000
We also see intermittent warning and informational messages like the following in the windows event viewer:
A process serving application pool 'DefaultAppPool' exceeded time limits during shut down. The process id was '5256'.
A worker process with process id of '5256' serving application pool 'DefaultAppPool' has requested a recycle because the worker process reached its allowed processing time limit.
View 3 Replies
View Related
Apr 17, 2008
How to generate sql script(database backup file) including insert statements(that contains data from all the tables in the database) ?
View 3 Replies
View Related
Mar 28, 2006
I have created a SSIS package that reads 500 text files splits them into 4 raw files then reads them again and writes then to 4 database tables different Tables.
The reason form this is that my raw files have multiple types of records in them and it is only 1 Coolum. I split this out into the different types of records and load whole rows into the database.
ie input 1 txt file
<T6>
1:1000178
3:18148821-00
5:40204043
6:1
17:EX201036259NZ
25:0000304862
</T6>
<T1>
1:18148821-00
</T1>
<T5>
1:1511313
4:18126485-00
8:2006032510230300
17:EX201033399NZ
</T5>
<T6>
1:1511158
3:18084863-00
5:40617044
6:1
17:EX201033969NZ
25:0000302981
</T6>
End up begin rows in the T6 Table
1000178 18148821-00 40204043 1 EX201036259NZ 0000304862
1511158 18084863-00 40617044 1 EX201033969NZ 0000302981
T5 Table gets a new record
1511313 18126485-00 2006032510230300 EX201033399NZ
and T1 Table get a record
18148821-00
Anyway all this works find but I find that the DTExec process work fine until it has used up all the memory in the laptop in general it take 400megs to run this SSIS. I'm wondering am I missing something like don't run in a transaction. I know in the old DTS you could commit on each package and how do I turn all logging off eg what you see in the DOS box (can I do this?) would love some help on this and if anyone want a copy of this ssis package ie your trying to do the same then I'm more than happy to email it.
View 5 Replies
View Related
Jun 8, 2007
Hey everyone,
I am planning on running a weekly report on a database that has its data overwritten every day. If i wanted to compare current data to data from the previous week, is there a way to save this report's information or something so that I will be able to pull it back up? Thank you.
View 3 Replies
View Related
Jan 12, 2008
Hi,
Can anyone write a stored procedure for me to take backup the database in certain location of the harddisk(Example D:MyProjectBackup).
Thanks.
Regard
Kashif Chotu
View 5 Replies
View Related