Sum Up Number On The Time Line

Jul 22, 2007

Hello.
I have a query That look like that:

"SELECT COUNT(*),MONTH FROM TABLE GROUP BY MONTH"

The result is:
Jun 2
Feb 2
Mar 3
Apr 0
May 5

What I want to have is that every month will sum up the previous month and him self so in the end I will be able the create a graph wuth those numbers:

Jun 2
Feb 4
Mar 7
Apr 7
May 13

Any ideas on how to start?

View 3 Replies


ADVERTISEMENT

Sum Up Number On The Time Line

Jul 22, 2007

Hello.
I have a query That look like that:

"SELECT COUNT(*),MONTH FROM TABLE GROUP BY MONTH"

The result is:
Jun 2
Feb 2
Mar 3
Apr 0
May 5

What I want to have is that every month will sum up the previous month and him self so in the end I will be able the create a graph wuth those numbers:

Jun 2
Feb 4
Mar 7
Apr 7
May 13

Any ideas on how to start?

View 1 Replies View Related

How To Enter More Number Of Rows In A Table Having More Number Of Columns At A Time

Sep 24, 2007

Hi

I want to enter rows into a table having more number of columns

For example : I have one employee table having columns (name ,address,salary etc )
then, how can i enter 100 employees data at a time ?

Suppose i am having my data in .txt file (or ) in .xls

( SQL Server 2005)

View 1 Replies View Related

Line Number In Transact SQL

Feb 16, 2004

Hi,

How do you generate line numbers in Transact SQL?

Example:

In Sybase, I could use this...
select number(*), customer_name from customer_table

number(*) customer_name
----------------------------------------------------
1 Customer Name 1
2 Customer Name 2
3 Customer Name 3


Thanks,
Geoff

View 2 Replies View Related

How Do We Locate Exactly The Line Number Of The Er

Sep 1, 2006

when we get something like this in QA:
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near ','.

I only have 3 lines inclusing only one insert. How do I know what value or keyword is wrong from the error message above.

Thanks

View 4 Replies View Related

Finding A Line Number

Sep 7, 2006

I have a large query that I am trying to debug in query analyzer.However, the errors I get have no line number or reference to wherethey are failing. How can I find out what line in the query is causinga particular error message to appear?ThanksJohn IveySouth Pike School District

View 2 Replies View Related

Script Line Number

Jul 20, 2005

When you get a server error message referring to a line number in ascript, is there an easy way to jump to the correct line? It's noteasy to count down in a big script or when there is a lot of whitespace.In WordPerfect we had a linenum macro that allowed you to enter theline number and it would jump to the line using the same countingmethod as the interpreter that generated the error message. Is theresomething similar with TSQL, or another way?Kerry

View 2 Replies View Related

Return The Line Number Of The Error

Feb 4, 2004

i have a huge stored proc which has about 8-9 cursors which move data from a few temp tables to the final tables...and also do lots of calculations in between..

anytime there is an error in the stored proc i have an error page which looks like this

**********************
Server Error in '/WebApplication3' Application.
--------------------------------------------------------------------------------

Error converting data type varchar to bigint. 139 pdiscnum 37 3429 4978 139 139 4979 50.93 189.93 4980 -189.93 0 4981 139 139 4982 -139 0 4986 23 23 4987 0 23 4988 0 23 5121 139 162 5122 -328.93 -166.93 3430 4983 89 89 4984 -89 0 5096 89 89 5097 -178 -89 5135 89 0 5144 139 139 3431 4989 89 89 4990 -89 0 5100 89 89 5101 -178 -89 3432 4991 139 139 4992 4.32 143.32 4993 -143.32 0 5102 139 139 5103 -278 -139 3433 4994 139 139 4995 50.93 189.93 4996 8.64 198.57 4997 -198.57 0 5003 0 0 5123 139 139 5124 -328.93 -189.93 3434 4998 59 59 4999 -59 0 5000 59 59 5001 -59 0 5002 0 0 5041 19 19 5042 0 19 5043 -2.39 16.61 5044 -16.61 0 5045 19 19 5046 -2.39 16.61 5047 -16.61 0 5056 0 0 5084 39 39 5085 -5.85 33.15 5086 -49.76 -16.61 5104 59 42.39 5105 .........

************************************************

a very lengthy page...the numbers are prbly due to the print stmts of the results of some calculations...
but my q is..is there any way to return the xact line number where the error occured in the stored proc instead of these infinite list of numbers...its taking pretty long time to go through the entire stored proc to isolate the error...

thanks

dinakar

View 4 Replies View Related

Use Trigger To Number Each Order Line

Jan 24, 2006

I am wanting to set up a trigger on our SQL server 2000 to create a sequential order line number in the OrderDetails table for OrderID.

I will be inserting data from an OrderLinesAdd table into the OrderLines table but want the LineNumber field to be incremented by 1 for each group of orders grouped by OrderID that I insert into the table eg.

OrderID LineNumber
1 - 1
1 - 2
1 - 3
2 - 1
2 - 2
3 - 1
3 - 2

I have just started using SQL so am not sure how I go about writing the code for the trigger ? It would seem like I will need to use the Max function in the code.

Thanking you in advance.

View 3 Replies View Related

Getting Line Number Sorted Out In Matrix

Dec 27, 2007

Hi there,

I have a matrix report that shows a certain columns and rows. I need a row counter to show me the amount of rows in that matrix but it doesn't count properly by using the expression: =Int(RowNumber("matrix1") -1)
I actually don't have any idea on what this expression should be to fix the row count...to illustrate what I get in the report:

______________________________________________________________________________
Chkp | Row | Serial No | Call of Date |Colour| Pillar | AV | Sport | USA | SRA | TAPE |
2019 | 1 | 7006892 | 2003/02/11 | 3644 | 78222 | 3902 | 9182 | | | |
| 3 | 7000123 | 2003/02/11 | 3299 | 17283 | | 9238 | 2793 | | |
| 5 | 7302031 | 2004/01/11 | 3902 | 28932 | | 3233 | 2332 | | |
| 7 | 7273211 | 2004/02/08 | 6727 | 39232 | 8228 | 3293 | | | |
| 8 | 7382728 | 2004/11/11 | 7822 | 32342 | 3902 | | | | |
| 13 | 7342934 | 2004/12/03 | 8323 | 23422 | 2031 | 9212 | 2934 | 2934 | 2982 |
| 18 | 7329491 | 2004/13/02 | 8291 | 92423 | 7922 | 0231 | 2342 | 2355 | 2223 |
| 22 | 7328438 | 2004/12/22 | 8399 | 92311 | | 0289 | 8392 | | 3982 |


As you can see above, the row count numbers are not lining up at all, it starts at 1, then jumps 2 every count then all of a sudden jumps 5 per line...a pattern that is interesting but difficult to understand. The unique value in this matrix is that serial number but even though i group it by the serial number, it still gives me the funny Row count values.

What would be the approach to solving this?

Regards
Mike

View 3 Replies View Related

There Was An Error Parsing The Query. [ Token Line Number = 1,Token Line Offset = 43,Token In Error = C]

Jul 27, 2007


Hello all
Trying to delete some data from a SSCE (2005) DB produces the exception:
SqlCeException
There was an error parsing the query. [ Token line number = 1,Token line offset = 43,Token in error = C]
Here is the code I am using

string dsc = Application.StartupPath + "\FCDB07.sdf";

conn = new SqlCeConnection("DataSource = " + dsc);

conn.Open();

cmd = conn.CreateCommand();

cmd.CommandText = "DELETE FROM DataContainer WHERE FileName =" + dgContainers[0, SelRowIndex].Value.ToString();

cmd.ExecuteNonQuery(); //There was an error parsing the query. [ Token line number = 1,Token line offset = 43,Token in error = C ]

conn.Close();

Any Idea on What causes this?

TIA
Trophus

View 3 Replies View Related

Error Parsing Query: [ Token Line Number = 1,Token Line Offset = 83,Token In Error = 5 ]

Nov 23, 2007

Hey all-

I'm trying to insert some values into an SQL Compact database on a WM6 device but there is something apparently wrong with my SQL statement...

The program is going to allow users to schedule an SMS message to be sent at a certain date and time. I'm using a database to keep track of the scheduled SMS messages. The database has 3 rows: phone number, message, and the date/time to be sent.

Here is the relevent code:


private void scheduleMenu_Click(object sender, EventArgs e)

{

//connect to DB and do our scheduling magic



string message = messageBox.Text; //should rename messageBox...

string phoneNum = phoneNumBox.Text;



string dataBase = @"Program FilesSMS_Scheduler2SMSDatabase.sdf";

//SqlCeEngine eng = new SqlCeEngine(dataBase);

SqlCeConnection conn = new SqlCeConnection("Data Source=" + dataBase);

conn.Open();



//insert phone number, message text, and date/time into DB
string cmd = "INSERT INTO Scheduler(phoneNum, message, date) VALUES("+ phoneNum + ", "+ message + ", "+ dateTimePicker1.Value +")";

SqlCeCommand cmdPhone = new SqlCeCommand(cmd,conn);





cmdPhone.ExecuteNonQuery(); //error occures here...



messageBox.Text = "";

MessageBox.Show("Message Scheduled!");

}



I'm guessing it doesn't like how I am trying to get the data from the different text boxes and the DateTimePicker to go inside the SQL command. Does anyone have any ideas on how to fix my SQL command or how to get data from a textbox and DateTimePicker to be inserted into a database a different way?

View 3 Replies View Related

Preconfigure Port Number While Command Line Installing

Dec 1, 2006

Hi,

I want set a specific port number of SQL Server(express) during installation not by Configuration Manager after install.
Is it possible?

View 1 Replies View Related

Generating Sequenced Line Numbers For Each Invoice Number

May 8, 2008

Can you help me with SQL issue I€™m stuck on?
I wish to take source data that looks like this:





Invoic_num

Line_num








6658

0








6658

2








6658

8








7721

2








7721

3







And rebuild the line numbers like this:





Invoic_num

Line_num








6658

1








6658

2








6658

3








7721

1








7721

2







This seems completely impossible to me. So I was thinking that maybe a second procedure using update could be run against the table after the initial build.

View 10 Replies View Related

How Can I Get The Actual Line Number From Inside Flatfile Sources For Each Record?

Jun 12, 2006

hi all,



maybe this is not a serious problem, but I tried for days to come toi a solution without success.

My Problem:

I have have several flatfile sources I need to import into a sql-server 2005 DB.

It is very important for me to have the original line number from inside the source file for each record. The rowcount transform doesn't fit in for this task, because it accumulates all rows until the end of the dataflow.

I tried script components and it works fine if i assume there are no errors in my source. then I simply could declare a local variable and count it up and add a custom collumn to my output. But for errors in my source this won't work, because a second script component won't know the actual value of a package level variable, which i use to store the value, because i am only allowed to access this variable in the post execujte method of the script.



How can I achieve my goal? Please help me...

Thanks in advance .. Bernd

View 11 Replies View Related

Send Mail Task Error - Limit To Number Of Chars In To Line?

Mar 22, 2006

Hello everyone,
I'm having an issue with dynamically setting the Send Mail task's to field to decent sized recipient list(approx 15 email addys). The strange thing is that this same package works fine if I'm using a list of say 4 email addys. I have double checked everything I can think of....list is seperated by semicolons, each address looks good....and have ran script tasks to check my variables along the path of the package but so far have not found the reason. The error I get is below:

"The specified string is not in the form required for an e-mail address"

Also of note, these addresses are being populated from a table, that is then setting the To string of the send mail task via a seperate variable...that variable being populated from a foreach loop. Again, all of this works fine with a smaller recipient list. Any ideas?

The only thing I can think of right now is to run the send mail task within the foreach loop...but then I'll be sending a seperate email for each address and would like to avoid that if possible.

Thanks,
Adrian

View 6 Replies View Related

What Is The Best Way To Implement An On-line Near Real-time Archiving Method?

Aug 9, 2000

Hi to you all and specially to who will solve my problem!

That is what I want:
I need a database that will serve as an archive db in read-only for day-to-day queries
and a production db that will be kept small by deleting un-needed records

A replication setup would be fine but I didn't find a way to avoid the deletes to keep the production database small, to replicate in the archive database where transaction are replicated.

Is there someting i am missing?

Andre Vigneau

View 2 Replies View Related

Convert Number To Time

Apr 2, 2008

In my database times are stored as integers. Therefore if someone arrives a 1am the value is 60, 2am 120 etc. Is there a way to convert these integer values to 1:00, 2:00. I've tried converting to a decimal so if somene arrives at 1:30 it returns 1.5, but I still only get the integer value...

CONVERT(decimal(10,2), (90/60)) AS iStart

Thanks in advance
Roy

View 2 Replies View Related

Distinct Serial Number And Latest Time

Feb 12, 2015

select SERIALNO, Max(TIME)
from dbo.TASK A
join dbo.Status B
on A.TID=B.TID
where A.ID in ('1111',2222')
and A.TYPE='Pen'
group by B.SERIAL_NO, B.TIME
order by BM.TIME

For this query I may get serial no duplicates but times are unique

For that serial no, I have to find the recent time. But if I use group by, I am getting the wrong no

View 2 Replies View Related

Blocks Of Time - Log Number Of Visits From Clients

Oct 30, 2014

I have the following SQL that I want to log the number of visits from clients. a session is a block of time, for example, any time between 9-12 is a morning sessions, 12-5 is an afternoon session etc. I need to count the number of sessions in a month not the appointments within the session, make sense?

select sr.resourceid, st.TimeStart, datename(m,sr.scheduledate) as sesmonth, datename(yy,sr.scheduledate) as year,
(CASE
WHEN DATEPART(hour, st.TimeStart) BETWEEN 0 AND 12 THEN 'MORNING SESSION'
WHEN DATEPART(hour, st.TimeStart) BETWEEN 12 AND 17 THEN 'AFTERNOON SESSION'
WHEN DATEPART(hour, st.TimeStart) BETWEEN 17 AND 24 THEN 'EVENING SESSION'

[Code] ....

View 2 Replies View Related

Update Column With Sequence Number Every Time

Sep 25, 2006

hello friends

i want to update one column from my table regularly on sequence number i.e. 0,1,2,3,4,5

i created procedure but it is not working as per my output

declare @IndexIDGen int
declare @ID int
set @ID = 0
update temp_test set indexid = NULL
declare IndexIDGen cursor for select indexid from temp_test
open IndexIDGen
FETCH Next from IndexIDGen into @IndexIDGen
while @@fetch_status = 0
begin
update temp_test set indexid = @ID where indexid is null

set @ID = @ID + 1
print @id
fetch next from IndexIDGen into @IndexIDGen
end

close IndexIDGen
deallocate IndexIDGen


where i am going in wrong direction ??????

T.I.A

View 8 Replies View Related

Time Series: Number Of Previous Values Used In Model

Nov 8, 2006

As the Microsoft Time Series algorithm implementation is based upon the Autoregressive Tree approach described in:

C. Meek, D. M. Chickering, D. Heckerman. Autoregressive Tree Models for Time-Series Analysis. In Proc. 2nd Intl. SIAM Conf. on Data Mining, 2002 (SDM-02). SIAM, pp. 229 €“ 244. http://www.siam.org/meetings/sdm02/proceedings/sdm02-14.pdf.

The model estimated is refererred to as an instance of "... autoregressive tree models of length p, denoted ART(p). An ART(p) model is an ART model in which each leaf node of the decision tree contains an AR(p) model, and the split variables for the decision tree are chosen from among the previous p variables in the time series..." (see the last paragraph of p. 2 of the paper).

What is the value of "p" used in the Microsoft Time Series implementation -- specifically, how many previous time series variables are used in estimating the model? It doesn't appear that this value can be specified in the algorithm parameters -- is that correct?

Thanks,

- Paul

View 1 Replies View Related

How To Represent Maximum Number Of Books Borrowed At Same Time Through A Trigger

Feb 20, 2013

I have to build a database model, create tables and use triggers or/and procedures on it. It's about a library. Books are borrowed by students. They can make a reservation of a book.

I built the database model so far. My problem is how to represent following tasks:

- Students can borrow a maximum of 5 books at the same time.
- bookings/book reservations should be later processed in the order they occurred. That is, who first flagged the book also gets the book/books first

I have following entities:

- Book
- Book exemplar
- Borrowed by (a table between the entities Book exemplar and Student)
- Reserved for (a table between the entities Book exemplar and Student)
- Student

How would you represent the tasks I mentioned above in terms of triggers or procedures?...

View 5 Replies View Related

SQL Server Admin 2014 :: How To Get Number Of Execution In Specific Time - Not From First

Apr 7, 2015

I have this query

SELECT top 100 Ltrim([text]),objectid,total_rows,total_logical_reads , execution_count
FROM sys.dm_exec_query_stats AS a
CROSS APPLY sys.dm_exec_sql_text(a.sql_handle) AS b
where last_execution_time >= '2015-04-07 10:01:01.01'
ORDER BY execution_count DESC

But the result of execution count is from the first. I want to know it only one day.

View 9 Replies View Related

How To Know Number Of Users Hitting A SSRS Report Over A Time Period?

Jan 24, 2008



Hi all,
I want to raise one question which might not relevant to current discussion.
Prob:-- I have some SSRS reports. I want to know for a given time period
1. How many people hit the report.
2. Who are the users hit the report in that time interval.

Is there any query to get that data?
Or,
should I go somewhere to see the data?

NB:- There is not any table in the application which is storing the data

View 10 Replies View Related

How To Return Time && Number Format That Has Set In The Regional Setting Using Stored Procedure

Dec 11, 2007

How to return time & number format that has set in the regional setting using stored procedure.
Following is my sp for getting current date format from Sql Server.

View 1 Replies View Related

Time Slot Which Has Maximum Number Of Purchase Orders Created Or Updated

Jul 15, 2014

I need to write down a sql query wherein in one particular day(user will enter manually), i need to find out a 15 minutes slot wherein purchase order's created or updated are the highest.

i.e. out of 96 slots(15 minute slot each)-I need to find the slot which has maximum number of Purchase orders created or updated.

View 7 Replies View Related

Trigger That Won't Allow A Member To Exceed Certain Number Of Loans At A Time Based On Their Category

Apr 14, 2015

I have an assignment to make a library. Right now I'm at the point of implementing business rules. One is that I need to create a trigger that won't allow a member to exceed a certain number of loans at a time, based on their category (student = 5, Teacher =10 and Researcher = 20).

View 1 Replies View Related

Integration Services :: Iterating Over Object In SSIS With Fix Number Of Results Each Time

Aug 11, 2015

I've got this issue with a query in SSIS. From a table in SQL Server I'm getting over 25000 different identifiers. These identifier are associated to many values in a table in  one Oracle Database. This is the schema that I have implemented for doing this.

The problem is that some days the identifiers can be over 45000, and at this point perform a loop for every one is not the best solution (It can take to much time to get the result). Previously I have performed another query where from the SQL statement.

I am creating and sending a unique row with all the values concatenated and then I have recover this unique string from an object and use it to create the query in the ODBC Source that invoke the table in Oracle: something like this:
'Select * from Oracle_table' + @string_values

with @string_values = 'where value in (........)'. It works good because the number of values is small enough to be used, like 250. But in this case I can not use this approach because the number is really big and obviously the DBA of Oracle is going to cancel the query.

So I wonder, how can I iterate over the object getting only a few number of values everytime, something like 300 or maximum 500, to avoid the cancellation of the query but at the same time doing the minimum number of loops.

View 5 Replies View Related

How Can I Remove The Line Feed/carriage Return In The Last Line Of The Exported Text File ?

Feb 27, 2007

Hi,
for some AP issue, the file I upload must be without the line feed/carriage return in the last line.
for example:

original fixed-length file (exported from SSIS)
line NO DATA
1 AA123456 50 60
2 BB123456 30 40
3 CC123456 80 90
4 <-- with line feed/carriage return in the last line

The file format that AP request. The file only has 3 records, so it should end in the third line.
line NO DATA
1 AA123456 50 60
2 BB123456 30 40
3 CC123456 80 90

Should I use script component to do it ? I am new for VB . Anyone would help me ?

Thank you all.

View 1 Replies View Related

Reporting Services :: Draw Trend Line For SSRS Line Chart 2005

May 4, 2012

I need the Trend line for the following data in Line chart they are the following data. The following are the graph are my output and i need the trend line for these Key_gap value.

This is the link [URL] ....

I need the same trend line for the Bar-Chart in SSRS 2005.

View 5 Replies View Related

Storing And Retrieving Line Breaks/newlines From Multi-line Textbox (C#)

Aug 31, 2007

I hope I'm posting this in the correct forum (forgive me if I'm not) since I'm not sure if this is an issue with inserting an item into a db or the processing of what I get out of it.  I wrote a basic commenting system in which someone my post a comment about something written on the site.  I wanted to keep it very simple, but I at least want the ability for a user to have newlines in their comment without having to hardcode a <br /> or something like that.  Is there a way for me to detect a newline if someone, for example, is going to their next paragraph?
Let me know if you need a better explanation.
Thanks in advance!

View 4 Replies View Related

ISQL: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect Syntax Near ' '

Nov 8, 2006

G'day everyoneThat's a space between the ticks.It's all part of a longer script but seeing as the failure occurs online 1if exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[config]') and OBJECTPROPERTY(id, N'IsUserTable') =1)drop table [dbo].[config]GOThat's three lines only. Does it matter that they're in Unicode?Any ideas?Kind regards,Bruce M. AxtensSoftware EngineerStrapper Technologies

View 3 Replies View Related







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