Cisco CCM Oldest CDR Record Using Sql Query
Nov 9, 2007Hello all,
I need assistance in finding the oldest CDR record in Cisco Callmanager DB using sql query. The CCM version is 3.3(5).
Any assistance is needed. Thanks.
Hello all,
I need assistance in finding the oldest CDR record in Cisco Callmanager DB using sql query. The CCM version is 3.3(5).
Any assistance is needed. Thanks.
Is there a quick and dirty way to find the oldest record in a select query? There is a date column of type DateTime.
-Ringo
I have a database that keeps track of pledges, scheduled reminders, and payments.
A user sets up a pledge and then sets up a schedule for reminders to be sent for each payment of the pledge.
Pledge table - PledgeID,PledgeDate,PledgeAmount,etc...
ScheduledReminders table - ScheduleID,PledgeID,DueDate,ReminderDate,ReminderPrintedDate,ReminderPaidDate
AppliedPayments table - ScheduleID,PaymentID,PaidAmount,PaidDate (Junction table between ScheduledReminders and PledgePayments
PledgePayments table PaymentID,PaymentAmount,PaymentDate
What I need to know is, when a payment is being Inserted I need the payment amount applied to the oldest scheduled reminder record that has not been paid. But if the payment is more than the amount shown in the schedule reminder record, I need the balance to be applied to the next oldest schedule reminder record, etc...
Can anyone offer some good suggestions or examples on how to do this?
Hi,
I have a base query that will return the ID, StartDate and Code for all IDs. I SELECT only for Codes 5 and 9. For most of the IDs I return a record for both a Code 5 and Code 9. They will have different dates however. How could I select from this base query one record for each ID with the oldest date? The items in yellow are the ones that I would want to return to a report in SSRS. Is there a way to put this data in a temp table and read through it to compare IDs and grab the one with the older date?
ID
StartDate
Code
100
1/2/2000
5
100
4/6/2004
9
205
3/13/2002
5
205
9/10/2002
9
300
10/10/1999
9
407
2/12/2005
5
407
7/17/2007
9
Thanks,
rb
Greetings all. New user here. I'm just getting started with using sql query's with our cisco voIP call manager database. Although cisco has a utility "CDR" which runs pre-defined reports; it's not enough. So far there have been several request for specific data which "CDR" cannot compile, in which we have to use analyzer. Unfortunately I'm not versed and need a little help. It's been asked I pull a report from call manager which shows all "forced authorization Codes" cisco calls these client matter codes. Here is the query I tried using. It pulls all user data but the client matter code column is empty. I tried with * and *.* inside brackets as well.
select * from CallDetailRecord where clientmattercode=''
Can anybody help so I can get the records of who has what particular in use client matter code?
thanks to all in advance, I hope to learn as much as possible from the experts.
Please help.
I need a good CIsco forum.
Thanks.
I am building an SSIS package that will transform some data over a cisco VPN.
After establishing a cisco VPN connection some tables get pulled from this remote server onto the local server. that part is working fine.
the problem is that now i want to automate this whole process. The problem with my automating, is that when i launch the dos command line batch file to open the VPN connection, there is a msgbox window that comes up on the remote server with a successful login, perhaps intentionally, that you have to manually click 'continue' and then the VPN is attached. it could be purposely put there so that hackers cant just have a process that is automatedly trying to ping for vpn connections.
So my question is, what solution options do i have in trying to get around this need ot manually click ok, when i am automating the running of this SSIS package?
comparable problems used to happen in the dos world and you could use a /S to suppress any message boxes that come up during the executing of a batch file.
i just need like 1 mouse click in the mouse buffer that would fire once the message box came up to continue on....
Thank you for any help.....
What ports do i need to open on my Cisco Firewall in order to allow someone outside my firewall access to SQL? They want to connect using MGT Studio.
Thanks
Bosco
Hi,
We're running a Sage CRM install with a SQL Server 2000 database at the back end. We're using the Sage web services API for updating data and a JDBC connection to retrieve data as it's so much quicker.
If I retrieve a record using the JDBC connection and then try and update the same record through the web services, the query times out as if the record is locked for updates. Has anyone experienced anything similar or know what I'm doing wrong? If I just use DriverManager.getConnection() to establish the connection instead of the datasource, and then continue with the same code I don't get these record locking problems. Please find more details below.
Thanks,
Sarah
The JDBC provider for the datasource is a WebSphere embedded ConnectJDBC for SQL Server DataSource, using an implementation type of 'connection pool datasource'. We are using a container managed J2C authentication alias for logging on.
This is running on a Websphere Application Server v6.1.
Code snippet - getting the record thru JDBC:
DataSource wsDataSource = serviceLocator.getDataSource("jdbc/dsSQLServer");
Connection wsCon = wsDataSource.getConnection();
// wsCon.setAutoCommit(false); //have tried with and without this flag - same results
Statements stmt = wsCon.createStatement();
String sql = "SELECT * FROM Person where personID = 12345";
ResultSet rs = stmt.executeQuery(sql);
if(rs.next()){
System.out.println(rs.getString("lastName"));
}
if (rs != null){
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (wsCon != null) {
wsCon.close();
}
we have an isseu with 2 reports the are not showing in internet explorer when the client is connected by VPN Cisco Client. The same reports work fine when they are at the office not using the VPN. We have this error in the report server log.
y!ReportServer_0-744!2e80!07/29/2015-07:16:59:: i INFO: RenderForNewSession('/Ventes - Sales/Rapport des directeurs - Directors' report (Last Period)')
webserver!ReportServer_0-744!2e80!07/29/2015-07:18:15:: i INFO: Processed report. Report='/Ventes - Sales/Rapport des directeurs - Directors' report (Last Period)', Stream=''
rshost!rshost!73c!07/29/2015-07:18:15:: e ERROR: WriteCallback(): failed to write in write callback.
rshost!rshost!73c!07/29/2015-07:18:15:: e ERROR: Failed with win32 error 0x03E3, pipeline=0x00000000036EA760.
[code]....
Hello there,I have a problem when I'm trying to order by the date..I have tried this string:SelectCommand="SELECT TOP 5 [Date], [Id], [Navn], [ShortInfo] FROM [fest] ORDER BY [Date] DESC">
And I have these dates:
04/02/2008
06/02/2008
20/02/2008
29/02/2008
08/03/2008
28/03/2008They should be shown like this:
04/02/2008
06/02/2008
20/02/2008
29/02/2008
08/03/2008
But they dosn't, insted is they shown like this:
29/02/200828/03/200820/02/200808/03/200806/02/2008How can I do, so it work?Regards Jeppe Richardt
Hi,
I have a database that stores monthly nameed tables for historical data, but after a time (could be 1,2,3 months or on request) I need to be able to delete the oldest table. The tbale name format is ?????_mm_yyyy. Is there a MIN statement that could work on the create date?
Any T-SQL statements that would help me on my way would be great
Thanka!
Is there a stored proc to tell details of the oldest active transaction ?
View 3 Replies View RelatedI may have one or several files in a folder that act as source files.
How do I loop through the folder, picking the oldest dated file according to its 'Date Modifield' attribute.
Do I have to use a Script Task or similar as I can't seem to find a way to do it with normal tasks.
If so, does anyone have example code.
Thanks
P R W.
I have a table that I need to delete the oldest date. I thought I could just do an update statement saying...
Delete T_BreakDown
where Date = MIN(Date)
But that doesn't work.
I have the following tables in my DB
Employee table - This table has EmployeeID, Name, DOB.
EmployeeDesignation table - 1 Employee can have many designations with each having an effective date. There is no flag to indicate which among multiples is the current entry. You can only figure it out by the newest/oldest EffectiveDate. I want to get the most recent and the oldest for each employee.
EmployeeSalaryHistory table - Structure/Design is similar to EmployeeDesignation table. I want to get the starting salary and current salary for each employee.
I want my query to output me the following fields...
EmployeeID
EmployeeName
EmployeeDOB
EmployeeStartingDesignation
EmployeeCurrentDesignation
EmployeeStartingSalary
EmployeeCurrentSalary
Here is a piece of code to generate sample data sets
DECLARE @Employee TABLE (EmployeeID INT, EmployeeName VARCHAR (100), EmployeeDOB DATE)
INSERT @Employee VALUES (101, 'James Bond', '07/07/1945'), (102, 'Tanned Tarzan', '12/13/1955'), (103, 'Dracula Transylvanian', '10/22/1967')
DECLARE @EmployeeDesignation TABLE (EmployeeID INT, Designation VARCHAR (100), EffectiveDate DATE)
INSERT @EmployeeDesignation VALUES (101, 'Bond Intern', '01/01/1970'), (101, 'Bond Trainee', '01/01/1975'), (101, 'Bond...James Bond', '01/01/1985')
[Code] ....
Currently, I have a query to get this done which looks as below. Since I have more than 8K employees with each having multiple Designation and Salary entries, my query is taking forever.
selecte.EmployeeID, e.EmployeeName, e.EmployeeDOB,
(select top 1 Designation from @EmployeeDesignation ed where ed.EmployeeID = e.EmployeeID Order By EffectiveDate) EmployeeStartingDesignation,
(select top 1 Designation from @EmployeeDesignation ed where ed.EmployeeID = e.EmployeeID Order By EffectiveDate Desc) EmployeeCurrentDesignation,
[Code] ....
How to Get previous record thru sql query
For the example
my table:
1 usera item1 1.00 01/02/072 usera item1 2.00 02/02/073 userc item2 3.00 03/02/07
--how to use the query to make them join became like this (get/join with the next record)
1 usera item1 1.00 01/02/07 item1 2.00 02/02/073 userc item2 3.00 03/02/07 null null null
>.<need help ... thanks alot
Hi I have a query that return set of records between 2 given timestamps. What I want to do is to include one record before and one record after to the result. For example I have the following dataRow Timestamp1 01/01/20072 15/03/20073 17/04/20074 05/05/20075 10/05/20076 11/06/20077 12/07/2007 My query returns row 3 to 5 for example and I want to include row 2 and 6 to the result as well. How can I do that? Is it possible to do it in 1 query?
View 11 Replies View RelatedI have a table called Customers which holds the customers details including CustID primary key a table called DVDs which holds all the dvd details including DVDID primary key and a table called WishList which holds the CustID and DVDID I want to take the CustID given my the user and display all the dvds in the wishlist with that CustID the code I have now is int CustID = Convert.ToInt16(Session["CustID"]); comm = new SqlCommand("SELECT DVDs.DVDID, dvds.Title, Director, Actor, SUBSTRING(Description,0,200) AS Description, Image FROM DVDs, Customers, WishList WHERE WishList.CustID = @CustID AND WishList.DVDID = DVDs.DVDID", conn); comm.Parameters.Add("@CustID", SqlDbType.Int).Value = CustID; but when i run the query it displays each dvd 5 times not sure why can any one help cheers
View 2 Replies View RelatedHello,
I'm a bit new to MS-SQL so i thought maybe you could help me.
This is my prob. I have an Access application that i have upsized to a MS-SQL server. I have a query based on 3 tables: Customers, Companys and Payreminders. When i run this query, i can't add new records or make any changes.
If i only run the query with the tables: companys and payreminders i can add new records and edit them. If i run a query that's based on companys and customers, i can edit and add new records, but when i run the query based on companys and customers i can't add or edit records.
companys, payreminders: Editable
payreminders, companys: Editable
Companys, customers: Non editable
Companys, payreminders, customers: Non editable
Something must go wrong when i use the companys and customers table. Can anybody help or give a suggestion what to do.
Thanks.
Hi
I have a column in a table which has html text. Eg
<p>[Video:-123xyz] <br />A video showing blah blah</p>
I wish to update the data between the two square brackets within the rest of the text to:
<p>[View:http://www.video123.com/-123xyz] <br />A video showing blah blah</p>
...so basically i need to find all occurrences of '[Video:' and replace it with '[View:http://www.video123.com/' .
Please can someone point me in the right direction?
cheers
happy friday...
my table has 200,000 + records and I want to see the particular record which I think it is causing the problem.
How could i query 195,203rd record?
thank you, yanoroo
Here's the scenario. Consider the following sample data.
CREATE TABLE #MyTest
(
CustomerNumber INT,
Division CHAR,
SalesRepType INT,
SalesRepNumber INT,
EnterDate DATE
[code]....
Essentially, what I’m attempting to do is for each Customer, Division, SalesRepType determine who the most recent assigned SalesRepNumber is and when (EnterDate) that person was assigned. So using the sample data, I would expect the following results.
CustomerNumberDivisionSalesRepTypeSalesRepNumberAssignedDate
10000A11002/1/2015
10000A23001/28/2015
10000B14002/1/2015
10000B26002/2/2015
I’ve tried various ways of using a CTE and ROW_NUMBER trying to get at this, but the area that is giving me the problem is in Division A, SalesRepType 1. Here is what gets me close, but I’m picking on SalesRepNumber 200 instead of 100 for Division A and
SalesRepType 1.
WITH
cteCust (RowNum, CustomerNumber, Division, SalesRepType, SalesRepNumber, BeginDate)
AS
(
SELECT
[code]....
Hendra writes "I'd like to know is there any way or any statement that can help me to get first or last record from the group by query ?
I'm using sql Server 2000
Thank's
_Hendra_"
i need to retrieve the most recent timestamped records with uniquenames (see working query below)what i'm having trouble with is returning the next-most-recent records(records w/ id 1 and 3 in this example)i also need to return the 3rd most recent, 4th, 5th and 6th most recent- i figure if i can get the 2nd working, 3rd, 4th, etc will be cakethanks,brett-- create and populate tabledrop table atestcreate table atest(id int not null, name char(10), value char(10),timestamp datetime)insert into atest values (1,'a','2','1/1/2003')insert into atest values (2,'a','1','1/1/2004')insert into atest values (3,'b','2','1/1/2003')insert into atest values (4,'b','3','1/1/2002')insert into atest values (5,'b','1','1/1/2004')-- select most recent records with distinct "name"sselect a.* from atest as awhere a.id = (select top 1 b.id from atest as bwhere b.name = a.nameorder by timestamp desc )/*query results for above query (works like a charm)2a 1 2004-01-01 00:00:00.0005b 1 2004-01-01 00:00:00.000*/
View 6 Replies View Related
i have a database with a list of customers and goods that they have ordered. I want to send one email to each customer regardless of the number of products he has ordered. eg.
Userid, product id, createddate
1034 2000788 2006-09-01 14:50:19.880
1034 383002 7 2005-09-07 20:50:19.880
1034 4493903 2006-09-01 20:00:19.880
I am therefore making a query for getting the data.How can i get only one record for each customer?
Sincerely
wan.
I am having problems with a SQL query.
Table has 10 fields and I need to return them all. The three most importaint, at least for the filter I need are:
id, studentid, date, canceled.
I need to return the last max(date) grater than or equal to @dateparam which is not canceled for each studentid
I have worked out some solutions but am not happy with them. Specially woried about performance when the table grows. I am expecting in full production a table growth of about 3 million records per month.
what would be grate is if there where a way of returning a the coresponding id like in:
select studentid, max(date), related(id) as ids
from tablea
where canceled=0
group by studentid
then I could do:
Select *
from tablea inner join (select studentid, max(date), related(id) as ids
from tablea a
where canceled=0
group by studentid
) b on (a.id=b.ids)
Edit: Newer mind. I tested this query more after writing this, and now it seems to work!I hope it continues to work. In following query, else is never executed.CREATE PROCEDURE Put_into_basket( @Product_code varchar(20))ASBEGIN SET NOCOUNT ON;IF NOT EXISTS(SELECT * FROM dbo.t_shopping_basket WHERE Product_code=@Product_code) BEGIN INSERT dbo.t_shopping_basket (Product_code, Name,Price) SELECT Product_code, Name,Price FROM dbo.t_product WHERE Product_code= @Product_code ENDELSE --this part is never executed BEGIN UPDATE dbo.t_shopping_basket SET Quantity=Quantity+1 WHERE Product_code=@Product_code ENDENDGO The query should test if there is a record or row with Product_code=@Product_code. If there is not, that is the first part, one such row is inserted. Quantity has a default value of 1. Insertion works, one row is inserted. At least sort of. If there is already record, That's later part, Quantity is increased by 1. That too works, if ran separately.But when I test query, it never runs the quantity+1 part.
View 3 Replies View RelatedI was wondering if anyone could quickly identify why the query is not parsing through each line in the temp table? I am sure its something stupid and easy, but if anyone has an idea, I would greatly appreciate the help!
My results are the same row repeated exactly the same for the number of rows in the temp table.
Declare @Topic varchar(150)
Declare @CustomTitle varchar(150)
Declare @FullName varchar(100)
Declare @starttime datetime
Declare @endtime datetime
select
TOPIC = t.TopicName,
CustomTitle = e.ssCustomTitle,
StartTime = v.StartDateTime,
eFirstName = FirstName,
eLastName = LastName,
eEndTime = ssEndTime
INTO #tmpwork
FROM
brSession e
INNER JOIN v_SessionStartDateTime v on v.ssSessionId=e.ssSessionId
LEFT OUTER JOIN Topic t on t.TopicId=e.ssTopicId
LEFT JOIN brssPresenter ep ON (e.ssSessionID = ep.prSessionId)
LEFT OUTER JOIN Personnel p on p.PersonnelNbr=ep.prPerNbr
LEFT OUTER JOIN brVirtualRoom vr ON vr.vrBriefingId=e.ssBriefingId AND vr.vrVirtualRoomId=e.ssVirtualRoomId
LEFT OUTER JOIN brLocation bl ON bl.loBriefingId=vr.vrBriefingId AND bl.loVirtualRoomId=vr.vrVirtualRoomId
LEFT OUTER JOIN location BR ON BR.LocationId=bl.loLocationId
LEFT OUTER JOIN brssDetail1 dt on dt.dt1SessionId=e.ssSessionId
LEFT OUTER JOIN Competitor c on CompetitorId=dt.dt1CompetitorId
LEFT OUTER JOIN PresentationStyle ps ON ps.PresentationStyleId=dt.dt1PresentationStyleId
WHERE
e.ssBriefingID = 11749
and((not prConfirmModeId = 0) or (prPerNbr is null))
ORDER BY ssStartTime
SELECT @Topic = Topic,
@CustomTitle = CustomTitle,
@FullName = eFirstname + ' ' + eLastName,
@StartTime = starttime,
@EndTime = eEndTime
From #tmpwork
IF (@CustomTitle is not null)
IF (not @CustomTitle = '') --correct problem of ZLS
Begin
set @Topic = @CustomTitle
End
SELECT
Topic = @Topic,
StartTime = @StartTime,
FullName = @FullName,
EndTime = @endtime
INTO #Final
FROM #tmpwork
select * from #Final
drop table #tmpwork
drop table #Final
I'm no SQL whizz yet but I'm learning hard, and need to get some information from our DB rather urgently so have resorted to this fantastic forum, only I can't find what I'm looking for.
Basically I'm selecting a whole load of entries that have a (admission)date field after 2001, but I only want to return the Earliest (admission) for each (patients number).
Here is the script I have created to select all the data, but how can I limit the results to just the earliest (admission date) for each (patient).
SELECT
Admission_Year, Admission_Month, Age_On_Admission, [Length of stay(continuing)], [Patient's Number], [Cons epis seq no], Sex, [Main Primary Pas Diag], [Date of Death], [Epi duration], [OP Code1], [Admission date], [Date of Death] - [Admission date] AS [days before death],[Intended Management]
FROM dbo.Admissions
WHERE (Admission_Year > 2001) AND (Age_On_Admission > '64') AND ([Intended Management] = 'inpatient') AND ([Date of Death] IS NULL)
I would really appreciate it if anyone can help with this, I'm sorry I can't really contribute to this forum as an SQL expert as .net is really my forte and I usually spend my time contributing to the asp.net forums. :)
If I wanted to run a query on any table and in the recordset that is returned have an 'id' field (or whatever) with the record id of that record, how would I do this?
I'm thinking something like
Select field1, field2, recordNumber // derived somehow - not an actual field
from table
where the result woule be:
field1 field2 1
field1 field2 2
field1 field2 3
field1 field2 4
field1 field2 5
...
If I selected the data below, how could I write a query to only keep the latest record. I added a "FileDate" column to label the last record (FileDate 200807)I want to display.
LeaseIDOpID Year MonthMCFFileDate
208801407982006 107660200807
208801407982006 107680200801
208801407982006 107784200704
Table has details like below:
NAME UPATE-TIMESTAMP
==== ===============
mary time1
mary time2
mary time3
tom time1
tom time2
tom time3
tom time4
richard time1
richard time2
Output Expected:
NAME UPATE-TIMESTAMP
==== ===============
mary time3
tom time4
richard time2
In summary, the requirement is to fetch the latest upated record for each unique NAME.