RESET COUNTER

Nov 9, 2007

Hello everyone:

this procedure resets the business day to one for every month. It works fine except for the month of October. any idea or suggestions?

DECLARE @i INT
SET @i = 1
DECLARE @DateID INT,
@DtTimeD DATETIME,
@LASTDAY DATETIME
DECLARE c CURSOR
FOR
--
-- LASTDAY is the last day of the month
-- the counter will reset to 1 on the first of each month
--
SELECT DateID, DtTimeD, DATEADD(dd, -DAY(DATEADD(m,1,DtTimeD)), DATEADD(m,1,DtTimeD)) 'LASTDAY'
FROM D_DATE
WHERE WkDayIn = 'Yes' AND HolidIn = 'No'
OPEN c
FETCH NEXT FROM c INTO @DateID, @DtTimeD, @LASTDAY
WHILE @@FETCH_STATUS = 0
--
-- update the business day in D_DATE
--
BEGIN
UPDATE D_DATE
SET BusDay = @i
WHERE DateID = @DateID
--
-- reset the counter to 1 if it's the last day of the month
--
IF @DtTimeD = @LASTDAY
SET @i = 1
ELSE
SET @i = @i + 1
--
IF @@ROWCOUNT = 500
COMMIT
--
FETCH NEXT FROM c INTO @DateID, @DtTimeD, @LASTDAY
END
CLOSE c
DEALLOCATE c
GO

View 10 Replies


ADVERTISEMENT

Reset Identity Column Counter.

Aug 6, 2007

Is there a way to delete all items from a table that has an identity column and to reset the counter for all new insertions so that they begin at '1' again?

View 5 Replies View Related

How To Reset The Identity Counter On A Table Referenced By A FOREIGN KEY Constraint?

Apr 4, 2006

I know that TRUNCATE TABLE can be used to reset the identity counter, but it can't be used on a table referenced by a foreign key. Anybody knows how to do that? Thanks.

View 4 Replies View Related

Compare The Value Of A Variable With Previous Variable From A Function ,reset The Counter When Val Changes

Oct 15, 2007

I am in the middle of taking course 2073B €“ Programming a Microsoft SQL Server 2000 Database. I noticed that in Module9: Implementing User-Defined Functions exercise 2, page 25; step 2 is not returning the correct answer.

Select employeeid,name,title,mgremployeeid from dbo.fn_findreports(2)

It returns manager id for both 2 and 5 and I think it should just return the results only for manager id 2. The query results for step 1 is correct but not for step 2.

Somewhere in the code I think it should compare the inemployeeid with the previous inemployeeid, and then add a counter. If the two inemployeeid are not the same then reset the counter. Then maybe add an if statement or a case statement. Can you help with the logic? Thanks!

Here is the code of the function in the book:

/*
** fn_FindReports.sql
**
** This multi-statement table-valued user-defined
** function takes an EmplyeeID number as its parameter
** and provides information about all employees who
** report to that person.
*/
USE ClassNorthwind
GO
/*
** As a multi-statement table-valued user-defined
** function it starts with the function name,
** input parameter definition and defines the output
** table.
*/
CREATE FUNCTION fn_FindReports (@InEmployeeID char(5))
RETURNS @reports TABLE
(EmployeeID char(5) PRIMARY KEY,
Name nvarchar(40) NOT NULL,
Title nvarchar(30),
MgrEmployeeID int,
processed tinyint default 0)
-- Returns a result set that lists all the employees who
-- report to a given employee directly or indirectly
AS
BEGIN
DECLARE @RowsAdded int
-- Initialize @reports with direct reports of the given employee
INSERT @reports
SELECT EmployeeID, Name = FirstName + ' ' + LastName, Title, ReportsTo, 0
FROM EMPLOYEES
WHERE ReportsTo = @InEmployeeID
SET @RowsAdded = @@rowcount
-- While new employees were added in the previous iteration
WHILE @RowsAdded > 0
BEGIN
-- Mark all employee records whose direct reports are going to be
-- found in this iteration
UPDATE @reports
SET processed = 1
WHERE processed = 0

-- Insert employees who report to employees marked 1
INSERT @reports
SELECT e.EmployeeID, Name = FirstName + ' ' + LastName , e.Title, e.ReportsTo, 0
FROM employees e, @reports r
WHERE e.ReportsTo = r.EmployeeID
AND r.processed = 1
SET @RowsAdded = @@rowcount
-- Mark all employee records whose direct reports have been
-- found in this iteration
UPDATE @reports
SET processed = 2
WHERE processed = 1
END
RETURN -- Provides the value of @reports as the result
END
GO

View 1 Replies View Related

SQL Counter In Statement

Jul 5, 2006

Hi
I'm using a gridview to show a list of high scores in a c#.net page. The position of the score is not stored in the database, just the score, name and id.
In the gridview however I would like to indicate the position of the scores, the SQL statement sorts the records by ascending scores so the are already in the correct order.
Does anybody know how to include a counter in the SQL statement that I can refer to vai the gridview so that it is able to display it as the position?
Thanks in advance for any help!

View 2 Replies View Related

Multipage Hit Counter

Jun 21, 2004

SQL Databased Multipage Hit Counter

# 1 - You want a Multipage Hit Counter to keep track of the number of Hits each individual webpage gets in your website.
# 2 - You also want to store the Webpage Hit Count Values into a SQL Database, using Stored Procedures.

Using 2 Webpages as an example:

--------------------------------------------------------------------------------

Inside webpage #1 put insert the following:


<%@ Page Language="VB" Debug="true" %>

<%@ import Namespace="System.Data" %>

<%@ import Namespace="System.Data.SQLClient" %>

<script runat="server">

Sub Page_Load(Source as Object, E as EventArgs)

Dim objCon As New SQLConnection("server=yourServerName;User id=idName;password=yourPassword;database=HitsCounter")

Dim cmd As SQLCommand = New SQLCommand("EXEC dbo.webcounter1", objCon)

objCon.Open()

Dim r as SQLDataReader

r = cmd.ExecuteReader()

r.read()

strcounter3.text = "Hits : " & r.item(0)

end sub

</script>



Also insert the following inside the body tags of webpage #1
<asp:Label id="strcounter3" font-size="X-Large" font-bold="True" bordercolor="Silver" width="300px" borderstyle="Inset" forecolor="Lime" visible="True" runat="server"></asp:Label>

Marked in Red webcounter1 is the Stored Procedures Name.
ALso marked in<B> Red counter3 is the name of the Database.
This is where you would make your changes inside the Webpages.

--------------------------------------------------------------------------------

Use the following Stored Procedure with Webpage #1

CREATE PROCEDURE dbo.webcounter1
WITH RECOMPILE
AS
BEGIN
SET NOCOUNT ON
DECLARE @hits INT
SELECT Hit FROM counter3
WHERE
ID = 1
update counter3 set hit = hit + 1
EXEC sp_recompile counter3
END
GO


--------------------------------------------------------------------------------

The Database Table has 2 columns which consists of an ---ID & Hit Column -- The Table Name is (counter3)
The best way to explain is by showing so posted below are Webpages 1 & 2 along with there Stored Procedures.


--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

Inside webpage #2 put insert the following:


<%@ Page Language="VB" Debug="true" %>

<%@ import Namespace="System.Data" %>

<%@ import Namespace="System.Data.SQLClient" %>

<script runat="server">

Sub Page_Load(Source as Object, E as EventArgs)

Dim objCon As New SQLConnection("server=yourServerName;User id=idName;password=yourPassword;database=HitsCounter")

Dim cmd As SQLCommand = New SQLCommand("EXEC dbo.webcounter2", objCon)

objCon.Open()

Dim r as SQLDataReader

r = cmd.ExecuteReader()

r.read()

strcounter3.text = "Hits : " & r.item(0)

end sub

</script>



Also insert the following inside the body tags of webpage #2
<asp:Label id="strcounter3" font-size="X-Large" font-bold="True" bordercolor="Silver" width="300px" borderstyle="Inset" forecolor="Lime" visible="True" runat="server"></asp:Label>

--------------------------------------------------------------------------------

Use the following Stored Procedure with Webpage #2

CREATE PROCEDURE dbo.webcounter2
WITH RECOMPILE
AS
BEGIN
SET NOCOUNT ON
DECLARE @hits INT
SELECT Hit FROM counter3
WHERE
ID = 2
update counter3 set hit = hit + 1
EXEC sp_recompile counter3
END
GO


--------------------------------------------------------------------------------

Now this type of Hit Counter works fine to a point.
Visiting Webpage #1 accumilates 1 Hit & Visiting Webpage #2 Accumilates 2 Hits.
And each time there 's a revisit to these pages they acquire 2 Hits each.
I'm Guessing the problem is in the Stored Procedure storing there values in Memory.
If Someone can Help Figure Out how to fix this. This could be a nice Website Multipage Hit Counter. I can use some help Guys feel free to advise.

View 3 Replies View Related

Record Counter

Nov 7, 2000

I'm trying to write a select that returns a result set with a counter added on. I want to do it without using an identity column or cursor. Something along the lines of select col1, max(col2)+1 from tab1.
I get (as expected)

col1 col2
------- ------
a 25
b 25
c 25

I want

col1 col2
------- ------
a 25
b 26
c 27

Thanks,

Jim

View 2 Replies View Related

Thread Counter

Oct 23, 2003

Hi Everyone,

The sqlserv.exe takes too much CPU utilization on my SQL 2000 on W2K production machine. I am tring to use System Monitor to monitor the Thread/%process time with all Sqlservr instances, and then match the sqlservr instance number to the KPID in sysprocesses table to find out which user is causing the problem. but I can only see the instance number from Sqlservr0 to sqlservr99. From the table sysprocesses table, the KPID is all 3 or 4 digits number. Any one has any idea about this?

Thanks in Advance.

Jason

View 2 Replies View Related

Record Counter

Oct 11, 2006

I need to add a ClaimCount column to a table. I am having a bit of trouble with the SQL to make sure it populates correctly.

Current Table

claim#namePaid
123George Washington50
123 George W Washingon50
124Sam Adams100
126George Washington75
128Rich Cheney69
128Dick Cheney69
128Richard CHeney69



Want to add a column (ClaimCount) as follows

Claim#namePaidClaimCount
123George Washington501
123 George W Washingon502
124Sam Adams1001
126George Washington751
128Rich Cheney691
128Dick Cheney692
128Richard CHeney693

Rules for ClaimCount.
1) there is no order by, It doesn't matter which record with the same Claim# is 1 or 2 or 3...

Appreciate the help.

Ray

View 10 Replies View Related

Incremental Counter

Nov 16, 2007

I am looking to create a incremental value based on the resulting insert that I am using. There already is another field being used as an identity field. I have a beginning value that I just want to add the row number to for the insert.

insert into lineitem select substring(group_id,4,len(ltrim(rtrim(group_id)))-3) as co_code,
0,0,(case when enddate < cast(month(getdate()) as varchar(10))+cast(day(getdate()) as varchar(10))
then 'Prior' else 'Current' end ),
left(acct_type,2) as bene_type, convert(smalldatetime,left(ltrim(rtrim(eff_date)), 8)),
0,trans_amt,0,0,convert(smalldatetime,left(ltrim(r trim(sett_date)),8)),
ltrim(rtrim(b.fname)) + ' ' + ltrim(rtrim(b.lname)) as payee,0,0,a.ssn,'Y',999+count(*),
(case when isnull(b.location,'') = '' then '' else b.location end) as location
from mbi_tran_temp a
left join enrollees b on a.ssn = b.ssn and
ltrim(rtrim(a.group_id)) = ltrim(rtrim(b.mbicode))

The '999+count(*)' is where I would like to have the incremental value.

View 13 Replies View Related

Simple Row Counter

Mar 9, 2004

It sound like a simple task to perform but I just can't seem to get it. I've built a search function on the site and after each search request, a log is kept of the search word and the date, so the table looks a little like this:

ID&nbsp;&nbsp;SearchTerm DateSearched
============================
1&nbsp;&nbsp;&nbsp;home&nbsp;&nbsp;&nbsp;2004/03/09
2&nbsp;&nbsp;&nbsp;fred&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2004/03/08
3&nbsp;&nbsp;&nbsp;cup&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2004/03/08
4&nbsp;&nbsp;&nbsp;home&nbsp;&nbsp;&nbsp;2004/03/08
5&nbsp;&nbsp;&nbsp;home&nbsp;&nbsp;&nbsp;2004/03/08
6&nbsp;&nbsp;&nbsp;fred&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2004/03/07

I want to pull out each of the search terms as well as how many times they've been searched on so I could display it in the format like so:

Word&nbsp;&nbsp;&nbsp;Qty
============================
home&nbsp;&nbsp;&nbsp;&nbsp;3
fred&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2
cup &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1

Any help would be appreciated. Thanks.

Goran (GoMo)

View 4 Replies View Related

T-SQL (SS2K8) :: Way To Add A Counter At End Of Each Row

Aug 18, 2015

My client wants IN_PUNCH to be the first in punch of the day and the OUT_PUNCH to be the last out punch of the day based on the TransactionDate as it is showing in the desired results table for 07/29 and 07/30 (Changes are highlighted in Bold).

I tried using MIN and MAX at different areas but to no avail.Also, is there a way to add a counter at the end of each row so in case if there were two shifts in a day then it be a '1' for row 1 and a '2' for row 2?

WITH SampleData (PERSON,TRANSACTDATE, STARTDATE, END_DATE, IN_PUNCH,OUT_PUNCH,HOURS,PAYCODE,SHIFT_LABEL,DOW) AS
(
SELECT 1234,'07/27/2015','07/27/2015','07/27/2015', '12:00','12:00','8', 'Hol', 'NULL', 'Monday' UNION ALL
SELECT 1234,'07/28/2015','07/28/2015','07/28/2015', '08:00','','4.00', 'Absent', 'Batax 1st','Tuesday' UNION ALL
SELECT 1234,'07/28/2015','07/28/2015','07/28/2015', '12:15','14:00','3.75', 'Regular', 'Batax 1st','Tuesday' UNION ALL

[code]...

View 2 Replies View Related

Getdate Day Counter

Dec 13, 2006

Hello,

I need to count the days (24 hours)from the (GETDATE()),returning an integer in a table column, automatically, all the time , under the scene until after a specified number of days (usually 20 for example), the relevant table row is be automatically deleted, replaced by another insert (row) to start again and the process repeated many times.

I have a database which works automatically. The data need not to be queried or manipulated until the row is deleted automatically.
I use SQL Server 2000.

Any ideas of doing this in a simple way ?
Regards and thanks in advance.Yves.

View 12 Replies View Related

Sequence Counter

Nov 5, 2007

I'm looking for a query that will look at an Id field and if it occurs more than once then returns the count of the times it occurs. For Example,

ID Code GetSequence
4 239 1
4 241 2
4 3243 3

View 5 Replies View Related

Record Counter

Feb 15, 2006

I have a form that I turned off the nav buttons. I then create my own.The reason I do is that I cna then move the nav buttons any where I needto on the form.The only thing I can not figure out is on the default ones, it shows thetotal records. I can not figure out how to do this. The form is based ona table and when I add a record or delete a record I want to make ssurethe total displayed is correct.How can I display the total records, for the table, on the form on thefly?Does that make sense?Michael Charneym charney at dunlap hospital dot org*** Sent via Developersdex http://www.developersdex.com ***

View 1 Replies View Related

How To Use Variables As A Counter?

Aug 8, 2006

While inserting data into a target table, I'm trying to populate a primary key ID field sequentially. For each record, the value of the primary key field needs to be incremented by one (a counter).

I've tried to use the RowCount transformation to store the values in a variable. I'm able to successfully do that; however, I don't know how to read or update the variable incrementally.

If someone knows how to perform this task, please let me know. I would greatly appreciate it.

View 3 Replies View Related

Counter By Group

Jul 18, 2007

How can I create a counter (line#) by group were it resets = 1 whenever a new group starts.



Customer Line#

A 1

A 2

A 3



B 1



C 1

C 2

View 3 Replies View Related

Insert Counter

Apr 8, 2006

when a new record is inserted in to table, i want to increment the variable called counter by 1

how can i implement this?

what is the IDENTITY field in a table? is it something like a counter variable

pls let me know

View 4 Replies View Related

Database Page Counter

Aug 6, 2004

Hi All,

I need some comments regarding my Hit Counter that I have created for my sites. Here is my case:

I have developed several websites which I host along with MS SQL server. I created a class that calls a stored procedure to add a count to the database field. The way that I am using it is that every page in the page_load event will call the class indicating which counter to use (i.e. LoginPage, HomePage, ProductPage, etc.). The class in turn will perform the database route to increment the counter. In the Store procedure before incrementing the counter, I first check to see if a record for the current date has been created, if not I add the record with a date stamp with all the different counter values as zero. I then will add 1 to the desired counter for the date.

Is this a good solution?

What I now want to do is create a page that allows the different website owners to access a page with the relevant page counters.

Any ideas will be greatly appreciated.

Thanks

View 2 Replies View Related

Can't Start Performance Log Counter

Jul 22, 2005

I'm a local admin on a SQL Server with dba permissions. I can view that SQL Server in System Monitor and I can create a performance log counter. When I try to start the counter, I get an error: ---------------------------
Performance Logs and Alerts
---------------------------
The SQLSever log or alert has not started. Refresh the log or alert list to view current status, or see the application event log for any errors. Some logs and alerts might require a few minutes to start, especially if they include many counters.
---------------------------
OK
---------------------------

Does anyone have ideas why this isn't working?

View 14 Replies View Related

How To Delete A Counter In A Field ?

Aug 28, 2006

I want to delete a counter using an SQL query (alter, drop...)

What could be the SQL query

View 3 Replies View Related

Line Count Counter

Jun 13, 2008

CREATE TABLE#Info
(
DbName SYSNAME,
ROUTINE_TYPE SYSNAME,
ROUTINE_NAME SYSNAME,
Lines INT
)

EXECsp_msforeachdb'
INSERT#Info
(
DbName,
ROUTINE_TYPE,
ROUTINE_NAME,
Lines
)
SELECT''?'',
d.ROUTINE_TYPE,
d.ROUTINE_NAME,
SUM(CASE WHEN d.c10 < d.c13 THEN d.c13 ELSE d.c10 END)
FROM(
SELECTROUTINE_TYPE,
ROUTINE_NAME,
1 + LEN(ROUTINE_DEFINITION) - LEN(REPLACE(ROUTINE_DEFINITION, CHAR(13), '''')) AS c13,
1 + LEN(ROUTINE_DEFINITION) - LEN(REPLACE(ROUTINE_DEFINITION, CHAR(10), '''')) AS c10
FROM.INFORMATION_SCHEMA.ROUTINES
) AS d
GROUP BYd.ROUTINE_TYPE,
d.ROUTINE_NAME
'
SELECTDbName,
ROUTINE_TYPE,
ROUTINE_NAME,
Lines
FROM#Info
ORDER BYDbName,
ROUTINE_TYPE,
ROUTINE_NAME

DROP TABLE#Info

E 12°55'05.25"
N 56°04'39.16"

View 15 Replies View Related

How To Get Sum Of Counter With Time Difference

Dec 9, 2013

Table

DateField--------------CNT-1 CNT-2 CNT-3
2013-12-09 09:00:00.000 8 1 2
2013-12-09 09:01:00.000 3 7 1
2013-12-09 09:02:00.000 1 2 3
2013-12-09 09:03:00.000 2 5 2
2013-12-09 09:04:00.000 1 1 7
2013-12-09 09:05:00.000 2 3 2

My requirement is to get the output in the following format if i take the time with 2 minutes difference

DateField ------------------ Sum-CNT-1 Sum-CNT-2 Sum-CNT-3
09:00:00.000 - 09:02:00.000 12 10 6
09:02:00.000 - 09:04:00.000 3 6 9

Is there anyway i can write down a query to get the sum of the counter with 2 minutes difference. I may take time slot between 9 AM to 10 AM so i should get the sum of the counter with 2 minutes gap in a single query.

View 1 Replies View Related

Performance Counter Problem

Oct 5, 2005

I'm installing SQL2005 September CTP on a fresh W2K3 SP1 machine running on Virtual Server.

View 1 Replies View Related

This Should Be The Easist Thing To Do... Have A Counter...

Apr 25, 2007

This should be so easy.

All I want to do is have a cumalative counter that counts from 1 to whatever.



any ideas how i can do this?

View 6 Replies View Related

Group Counter In Condition

Oct 16, 2007

Hi All,
I have a tricky issue and plesae help:

My dataset likes this:

Level people
1 A1
1 A2
1 A1
2 A3
2 A3
2 A4
2 A4
2 A4



I want to create a summary report and get the results like:

Records People
Level 1 3 2
Level 2 5 3

I only two levels: Level 1 and level 2 and don't need consider the lable of level.

How can I implement this in the Table or Metrix?

TIA

Micror

View 1 Replies View Related

Counter Inside Select Statement?

Nov 14, 2007

Hi, can you add a counter inside a select statement to get a unique id line of the rows?
In my forum i have a page that displays a users past posts in the forum, these are first sorted according to their topicID and then they are sorted after creation date. What i want is in the select statement is to create a counter to get a new numeric order.
This is the normal way:
SELECT id, post, comment, created FROM forum_posts WHERE (topicID = @topicID) ... some more where/order by statements
This is what i want:
DECLARE @tempCounter bigintSET @tempCounter = 0SELECT @tempCounter, id, post, comment, created FROM forum_posts WHERE (topicID = @topicID)... some more where/order by statements and at the end.. (SELECT @tempCounter = @tempCounter + 1)
Anyone know if this can be done?

View 2 Replies View Related

Hits Table And Counter Reports

Jan 22, 2008

Using MSSQL (pre 2005):
I have a Link table:
int id (primary key/identity)
varchar(50) linkName
varchar(255) linkHref
//some other stuff
and my Hits table:
int id (primary key/identity)
int linkId (foreign key to Link)
datetime dateCreated
//some other stuff
Hits gets an insert whenever a link is clicked.  (All this works just fine)
I'm trying to create a report that shows each link by its name and href, a counter and the last date each link was visited.  What I currently have is an accurate listing for those that have been clicked on, but it does not show anything for links that haven't been clicked on.  Any suggestions as to how I can modify the following SQL to return "0" and "never" (or DBNULL) if no entries are found in Hits that have the same id?  Or do I have to do this in a couple queries?
SELECT COUNT(h.id) as counter, MAX(h.dateCreated) as lastVisited,
l.id as id, l.linkName as linkName, l.linkHref as linkHref
FROM Link as l INNER JOIN Hits as h ON l.id=h.moduleId
GROUP BY l.linkName, l.id, l.linkHref
 

View 6 Replies View Related

Unique Counter Field In A Table - Best Way?

Oct 11, 2005

I need to to have a table that has a counter field (used to generate an id code for a record).  This is not the primary id for the field but just a counter to label a record in another table, similar to a registration code for an event.  This is a sequential counter that will start 1 and go up on each new record inserted into other tables.  What I want to do is be able to query this counter table to get the next valid number and increment the count for the next time.  This is a multi user web app so needs to prevent duplicate use of same number.How best should this be handled?  A transaction to query and update the field?

View 6 Replies View Related

Append Counter Variable To Field Name

Jun 14, 2004

Hi all,

I have a table with fields name Days1, Days2, Days3 - I am trying to use a loop in conjunction with a counter to identify each of these fields - I can't quite get the correct syntax and it is driving me crazy!!!

Here's the proc:

WHILE @Counter < 4
BEGIN

SELECT @AppointmentsCount = COUNT(tbl_SurgerySlot.SurgerySlotKey)
FROM tbl_SurgerySlot INNER JOIN
tbl_SurgerySlotDescription ON tbl_SurgerySlot.PracticeCode = tbl_SurgerySlotDescription.PracticeCode AND
tbl_SurgerySlot.Label = tbl_SurgerySlotDescription.Label LEFT OUTER JOIN
tbl_Appointment ON tbl_SurgerySlot.SurgerySlotKey = tbl_Appointment.SurgerySlotKey AND
tbl_SurgerySlot.ExtractDate = tbl_Appointment.ExtractDate
WHERE (tbl_SurgerySlot.ExtractDate = @ExtractDate) AND (tbl_Appointment.AppointmentKey IS NULL) AND
(tbl_SurgerySlot.StartTime > @DateFrom) AND (tbl_SurgerySlot.StartTime < @DateTo) AND (tbl_SurgerySlotDescription.IsBookable = 1)

SET @FieldName = 'Days' + CONVERT(VARCHAR(20),@Counter)

INSERT INTO tmp_Availability (@FieldName)
VALUES (@AppointmentsCount)

SET @DateTo = DATEADD(Day,1,@DateTo)

--Increment the loop counter
SET @Counter = @Counter + 1

When I run the above the follwoing message is displayed:

Server: Msg 208, Level 16, State 3, Line 36
Invalid object name 'tmp_Availability'.

The object IS valid so I'm lost....

View 8 Replies View Related

Performance Counter Prepare Values

Feb 11, 2015

Which values are best prepared value for given below memory objects

Memory
Parameter

Total memory=
SQL Cache Memory=
Lock Memory=
Optimizer Memory=
Connection Memory=
Granted WorkSpace Memory=
Memory Grants Pending=
Memory Grants Success=

Cache Details:

Cache Hit Ratio=
Cache Used/Min=
Cache Count=
Cache Pages=

Scheduled Jobs:

Job Status=
Run date & time=
Job Time=
Retries Attempted=

How the above performance counters prepared values?

View 1 Replies View Related

Invalid Column Name Total Counter

Jan 23, 2015

Error Message "invalid column name on total_counter ". How to edit this query and make it work ?

SELECT salesman_code,user_group,user_name,trx_acc_amt,trx_date,trx_no,sh_code,
salesman_code4,salesman_code5,salesman_code6,
Sum(case when salesman_code4 is null then 0 else 1 end +
case when salesman_code5 is null then 0 else 1 end +
case when salesman_code6 is null then 0 else 1 end) as total_counter,

[code]...

View 5 Replies View Related

SQL Server 2000 Performance Counter

Jul 23, 2005

Will the next release of SQL Server 2000 64bit sp provide performancecounter?MarcM

View 2 Replies View Related







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