Counter For Max Tickets - Refer To A Database Table Row/column Etc
Feb 7, 2008
I posted a thread in the Getting Started forum about how to make a counter for maximum tickets : http://forums.asp.net/t/1215258.aspx
but maybe this is a more appropriate forum for this subject.
In a school project, we are making a website for a fictional concert/festival (using Visual Studio 2005, C#). On that site users can register and order tickets.
We have access to an SQL-database, by the way, where we can create tables etc.
We want the maximum amount of tickets to be 10000 per day. The festival is supposed to last from friday to sunday.
What would be the best way to do this programatically? The counter should maybe be in an own database table?
View 3 Replies
ADVERTISEMENT
Apr 9, 2008
Using SQL Server 2000. How can I refer to one alias in another column?E.g., (this a contrived example but you get the idea)SELECT time, distance, (distance / time) AS speed, (speed / time) AS acceleration FROM dataNote how the speed alias is used in the definition of acceleration alias but this doesn't seem to work.
View 11 Replies
View Related
Apr 10, 2008
Using SQL Server 2000. How can I refer to one alias in another column?
E.g., (this a contrived example but you get the idea)
SELECT time, distance, (distance / time) AS speed, (speed / time) AS acceleration FROM data
Note how the "speed" alias is used in the definition of "acceleration" alias but this doesn't work.
View 14 Replies
View Related
May 13, 2008
Hi,
I need to create a table (Named as C) with a foreignkey column. That column should references with a primarykey column in table A and a primarykey column in table B. Is this possible?
Thanks in advance.
ramesh.p
View 1 Replies
View Related
Oct 16, 2006
Hi all,
The requirement is to have a table say 'child_table', with an Identity column to refer another column from a table say 'Parent_table'..
i cannot implement this constraint, it throws the error when i execute the below Alter query,
ALTER TABLE child_table ADD CONSTRAINT fk_1_ct FOREIGN KEY (child_id)
REFERENCES parent_table (parent_id) ON DELETE CASCADE
the error thrown is :
Failed to execute alter table query: 'ALTER TABLE child_table ADD CONSTRAINT
fk_1_ct FOREIGN KEY (child_id) REFERENCES parent_table (parent_id) ON DELETE
CASCADE '. Message: java.sql.SQLException: Cascading foreign key 'fk_1_ct' cannot be
created where the referencing column 'child_table.child_id' is an identity column.
any workarounds for this ?
View 3 Replies
View Related
Jan 19, 2008
Hi,
Is there any way to group variables present in a select statement.
My code:
SELECT @var1=something, @var2=something_else
FROM ...
GROUP BY @var1
I wanted to group by 'something' hence I used a variable to assign it to. But I'm unable to group it.
Any thoughts?
Thanks,
Subha
View 1 Replies
View Related
Jan 13, 2000
hi,
please let me know how to refer to a row from a set of duplicated rows of a sql server database table.there are no primary keys/constraints in the table so as to refer it.Is there any thing like 'rowid' which we have in oracle?
thanks
sreeni
View 3 Replies
View Related
Apr 22, 2000
How do I refer to the user logged on to the database?
I can refer to a table as dbo.tblApptDaily,
but how do I refer to
[current user].tblApptDaily?
Create Procedure "prcCreateApptDaily"
as
Create dbo.tblApptDaily
(ID int primary key, ApptTime datetime,
book1 numeric, book_Status1numeric default (0), PN1 varchar (50), ApptID1
int,...LastID int)
View 2 Replies
View Related
Jul 20, 2005
Hi there,Could somebody post some simple example how one can refer toa column in the 'deleted' temporary table within a trigger definition ?Should the 'deleted' and 'inserted' temp tables be declared, or they are'implied' ?I keep having this msg when trying to create a trigger"The column prefix 'deleted' does not match with a table name or alias nameused in the query"Thanks for your inputs,Eddy.
View 2 Replies
View Related
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
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
Jul 10, 2015
How can I write it in SQL? I have a table that column  A   has two values of  Product  and Cost...Where value of A is Product, I have to add 6 more rows, and add column b with values from 1 to 7 for each rows ( counter)Where value of A is Cost, I have to add 4 more rows, and add column b with values from 1 to 5 for each rows ( counter).
View 3 Replies
View Related
Nov 16, 2015
I have a table ComponentPeriod. In it we have the combination of a component (e.g. A,B,C ) and a period (2014 Q1, 2014 Q2, 2014 January etc)I want the periods to be in descending order (2015 Q4, 2015 Dec, 2015 Nov, 2015 Oct, 2015 Q3 ... etc) and so I need to create a sequential number series to allow this to happen (as we can only order in the client tools by a single column - and so I guess the technique I'm looking for is used a lot to produce these types of "order by" columns)
I have done this in the past using
Period_Sequence =
calculate
(countrows(Period)
,filter
(Period
, Period[Start_Date] <= earlier(Period[Start_Date])
&& Period[Duration_String] = earlier(Period[Duration_String])
)
)
Which was fine when I was referring to a table where Periods where distinct directly but now I have denormalised this for ComponentPeriod so I need something a little more sophisticated Whats the best way to get a sequence with perhaps some partitions in across a subset of distinct columns (I guess from SUMMARIZE or similar)
E.g. I want
Period_Name, Type, Sequence
2015 Q4, Quarter, 1
2015 Dec, Month, 2
2015 Nov, Month, 3
2015 Oct, Month, 4
2015 Q3, Quarter, 5
2015 Sep, Month, 6
etc
even though there may be multiple records in ComponentPeriod that have the period 2015 Q4, but I want them all to have the value Sequence value of 1? I've got as far as:
Period_Sequence Desc =
calculate
(countrows(summarize(ComponentPeriod, ComponentPeriod[Period_End_Date]))
,filter
( ComponentPeriod
, ComponentPeriod[Period_End_Date] >= earlier(ComponentPeriod[Period_End_Date])
)
)
But this doesn't distinguish between the different types. I need an equivalent of the t-sql -
row_number() over (order by Period_End_Date desc, case when 'P3M' then 1 when 'P1M' then 2 end asc
View 7 Replies
View Related
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
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
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
Apr 21, 2008
Let me get VERY specific.
This site has 40+ pages Using VWD 2008 (Studio 2008)
I have created in local IIS7 (129.0.0.2) http://cumc.lcl
Navigation.master, Web.config and Web.sitemap alll are structured
And all 40+ pages have been built.
NOW I added (using VWD) a sql server database named pagedata.mdf
With a table named: pages
and fields:
PageID - Primary Key (auto numbered)
pagename - nchar(30) exmp Default
hitcount - numeric(18,0)
createdate - nchar(15) exmp 04/18/2008
updated - nchar(15) similar to createdate
hitdate - nchar(15) similar to createdate
bottom of each page is to show 99999 visitors
and under that is to be Updated on mm/dd/yyyy
On pageload should accomplish the following increment the hitcount
field and save it and display it in HitLabel.text
Set UpdateLabel.text to updated field
Save the date the page was hit in hitdate field. (will only show when last hit)
The "tester.aspx" page now has:
<%@ Page Language="VB" MasterPageFile="~/Navigation.master" Title="tester" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p align="center">This page is for various tests<br />and will NOT be site mapped.</p>
<p align="center"></p>
<p align="center">
Can this SqlDataSource be moved into Sub Page_load above?
How do I extract, process and save the Hit and Date data
for each individual page referenced by pagename field?
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsageConnect %>"
SelectCommand="SELECT * FROM [main] WHERE ([pagename] = @pagename)">
<SelectParameters>
<asp:QueryStringParameter Name="pagename" QueryStringField="thispage"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</p>
<p align="center">
<asp:Label ID="HitLabel" runat="server"></asp:Label>
Visitors<br />
Updated on <asp:Label ID="UpdateLabel" runat="server"></asp:Label>
</p>
</asp:Content>
View 2 Replies
View Related
Nov 10, 2014
I'm writing a query and I would like to pull records that show me any tickets that may have been created on a specific account within 72 hours of the first ticket. Each order/ticket is date and time stamped. I have been given a list of order numbers, and the requestor would like to see any orders that were created within 72 hours from the date/time the initial order was closed. I'm having a little difficulty figuring out how I would set that parameter within my query. I was thinking I could use:
where oc.create_dte_ocr <= dateadd(day,-3,date)
View 4 Replies
View Related
Jan 14, 2008
We are building a small utility tool application for clients who sometimes may not access the company central database. The application use the merge replication to implement the Web Synchronization of the SQL server database and SQL server compact edition database at the client machine.
After the installation of the application, we use the following code to create a sql server compact edition .sdf file.
SqlCeReplication repl = new SqlCeReplication();
repl.AddSubscription(AddOption.CreateDatabase );
repl.Synchronize();
Some machines run the process successfully, and the database .sdf was created and replicated successfully. However, some machines failed, the error message got is "SQL mobile encountered problems when creating database". All the client machines are Windows XP. We did some research and found someone commented SQL Server compact edition file (.sdf) is a medium integrity level resources file, in some windows system, IE runs in protected mode and is a €œlow integrity€? process, which caused the Access Denied.
Can anyone here know any solution to this issue? Any help is highly appreciated.
View 3 Replies
View Related
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
Jul 24, 2006
Hi, I am new to ASP and SQL. I have a sql database that has two tables. One is Employee Table and the other is Ticket Table and they are joined on EmployeeID.
Employee Table:
EmployeeID, FirstName, Lastname,
Tickets Table:
TicketID, EmployeeID, Status,Priority
I need a SQL statement that will list employee with the number of tickets he has open. For Example:
John Doe (10) . This list employee John Doe with 10 Tickets that have a status of Open.
I have tried count(*) , Max and everything I could find on web but I can not put the two together. I can get the total number of tickets that have a status of Open, I can even do a distinct statement that will show all employee's, however I can not figure out how to retreive both at the same time for each employee. Please help.
View 3 Replies
View Related
Jul 24, 2015
I have a generated a report in SSRS, but unable to generate a Student Hall Tickets for an examinations.
View 4 Replies
View Related
Oct 1, 2001
How do I copy a column(or colums) from a table in one database to another table in a different database
View 1 Replies
View Related
Oct 22, 2005
Hi
I am new to SQL2000 and also in RDBMS.
Pls suggesst the book which is helpful for me.
Thanks...
asm
View 6 Replies
View Related
Dec 14, 2005
I always create database tables with an id column with an autoincrementing number.
Does a table actually need this or can I remove this field if I don't refer to it?
thanks
Jon
View 5 Replies
View Related
Feb 13, 2015
I have researched how to put a URL column in my SQl Server 2008 database and table. I have tried varchar(max) and varchar(1000) and then done what I found online by inserting into the url with ' ' around it and then I ODBC into Access and it does not look like a link. Cannot link on it and have it go where it needs to. I have also tried this in the front-end application and it does not look like a link. It does not respond either.
View 4 Replies
View Related
Jan 17, 2007
Hi,
I need to provide a report that lists the databases in each instance, then the tablenames and the number of rows in each table.
Is there any easy way to do this in SQL 2005?
Cheers
Gregg
View 8 Replies
View Related
May 6, 2007
Hi,
I have a set of records in database table and I want to update one column to be the same for all of them.
Can you suggest code solution?
View 1 Replies
View Related
Oct 3, 2007
I have the folowing databases DB1,DB2,DB3,D4,DB5........
I have to loop through each of the databases and find out if the database has a tablename with the word 'Documents'( like 'tbdocuments' or 'tbemployeedocuments' and so on......)
If the tablename having the word 'Documents' is found in that database i have to add a column named 'IsValid varchar(100)' against that table in that database and there can be more than 1 'Documents' table in a database.
can someone show me the script to do it?
Thanks.
View 6 Replies
View Related
May 22, 2008
how can setup constraint for the column in table in database ??
and what will sould write in the (BLOCKED EXPRESSION field ??
View 5 Replies
View Related
Aug 18, 2006
hi
i have over 200 tables with all same column and data type locate all over the server(20)different database. so i have table call Tname to stored all the link like (databasename.dbo.tablename) so my job will call the Tname table to use cursor to insert records. but the problem is there's one or more table's column name K datatype has been modify by someone else. so is it cause the job fail.
if there a way or SQL statment that i can use Table Tname to see which one is missing column name K? and is there a way i can print out all the datatype and len for all the table column k? please help thanks
View 2 Replies
View Related
Aug 3, 2007
Can anybody tell me how to find out whether a particular column exists in any of the tables of a database and if it does, display the table names?
Thanks
View 3 Replies
View Related
Aug 13, 2007
Hi
I am learning Sql server 2005 replication.
My requirement is.
1.) Subscribe a Master database
2.) I have to add a timestamp column in every table of subscriber database ( Note: the column will not be in publication database)
I have two sql server
server 1 : I made Merger publication
server 2 : I made subscription of the same
But when i tried to create a column in the Subscriber database table its giving the following error
Validation warnings
warnings were encountered during the pre-save validation process, and might
result in a failute during save. Do you want to continue attempt to save?
''Table1' table
- Error validating the default for column 'rowguid'.
I clicked "Yes"
Post -Save Notication
Errors were encountered during the save process. Some database objects were not saved.
'Table1' table
- Unable to modify table.
The DDL statement cannot be performed at the Subscriber or Republisher.
The DDL operation failed inside merge DDL replication manipulation.
The transaction ended in the trigger. The batch has been aborted.
clicked ok
User canceled out of save diaglog
Can i add a new column to subscriber database table if so please guide me?
View 5 Replies
View Related