i have a form where I ask a number of questions
The answer for each question is a drop down menu ...
The person chooses one or many from the answer ....
e.g I would like a wrist band for Trip A (cost £6) {WristA}
I would like a wrist band for Trip B (cost £8) {WristB}
I would like wrist band for Trip C (cost £4) {WristC}
etc etc ....
I would like to grab thes responses from the form
and write SQL script to perform the total cost of wristbands...
Any ideas on how I can do this in SQL - the 'tokens' are available in SQL (i.e. {WristA} , {WristB}, {WristC})
hi all, i wasnt quite sure where to look to answer my particular problem so i am posting up this thread in the hopes that someone can point me in the right direction. in my report, i am showing sales figures for an area. i added a table to display sales from this year, sales from last year, and then the comparable percentage('this' divided by 'last' and then minus one). to account for some ppl who didnt have sales last year, i was able to use an IIF expression to return "N/A" in the textbox. my problem is i want the compared percentage to show for the area total, but not including ppl who were an 'N/A'. i am assuming that some sort of expression will be needed for the area total row, i.e. i want the area total to sum up this year and last year and then get the percentage, but i need to filter out the individuals who didnt have data for last year.
the percentage for total, X, should be (10/7)-1, with p0 as the format; right now it is summing rows A, B, and C.. how can i exclude row C from the calculation?
am i on the right track by researching filters and expressions, or is this a matter for the query thanks in advance for any help
I have created calcalated measures in a SQL Server 2012 SSAS multi dimensional model by creating empty measures in the cube and use scope statements to fill the calculation.
(so I can use measure security on calculations
as explained here )
SCOPE [Measures].[C];
THIS = IIF([B]=0,0,[Measures].[A]/[Measures].[B]);
Hello, My company Intranet has a form that agents can use to post their comments about the company to upper management, but our customer service department would like to modify the form so that the agent has to pick from a comment type. The dropdown options on the form will be as follows: ComplimentsComplaintsGeneral CommentsSuggestions Each dropdown option has a designated table in a SQL DB.Using postback on the same page, I need to change which fields of the form are visible based upon which dropdown selection the user chooses, and I need the fields to then be inserted into the table that corresponds with the dropdown selection item. For example: If the Compliments dropdown selection is picked, I need a text box to show for the user's location, the name of the customer, account number, and the message box. Once the submit button is clicked, the characters in these boxes need to be inserted into the Compliments table using its data adapter. However, if the user selects Suggestions, the name of the customer and the account number should not be visible, since these fields do not exist and when the submit button is pressed, the Suggestions table should be updated. If you need more information, I will provide whatever is needed. As always, thanks for everyone's assistance. Chris
Hi, I got a problem. I installed Microsoft SQL Server Management Studio Express 2005 version. And I created a Compact database. I created an connection in SSMSE to connect the database and opened a query form. then, i run the following sql:
Select * from Table1
It returned 3 records to me. After that, I used program to insert record into this table. Then i ran this sql again, it still show me 3 records. I closed the query form, and re-created a new query form, then run the sql, it returned 4 records to me.
Why? It's very strange and difficult to operate, right? Is there anyone know how to make the SSMSE to return whole records without any close query form and re-create query form operation?
Hi everyone, What is the main difference between first form normalizations and second form normalization ? In my opinion, they are both generated for the same operation which is to prevent redundancy(in other words; duplication of data in several records). So would you please explain it to me ?
HiI have a Platinum database which stores dates in integer form e.g the dateis formatted as below:Column_name Type Length Precision------------------------------ ------------------------------from_date int 4 10Some of the dates in the Platinum database are as follows:729115729359730059730241730302730455How can I bring them into SQL 2000 as valid dates.Thanks for your assistanceSam CJoin Bytes!
Sorry to ask a stupid question. I have SQL Server 2000 on SBS 2003. I can't find Perform.exe. Anybody know where it should be (I'm sure that you all do!),
Hi,any body pls help me with the concept called transaction ?Where excatly we are doin this ? In the SQL or through c# codings.i have 3 stored procedures, where i am calling this one by one to perform a single operation in the client side.if any one fails, due to some exceptions. it should rollback and come to the initial state.... How to perform this ? any ideas..
/*Reset Identity on tables with identity column*/ exec sp_MSforeachtable 'IF OBJECTPROPERTY(OBJECT_ID(''?''), ''TableHasIdentity'') = 1 BEGIN DBCC CHECKIDENT (''?'',RESEED,0) END'
-- City SET IDENTITY_INSERT City ON INSERT INTO Elbalazo.dbo.City ( [CityID] ,[CityName] ,[CountyID] ,[Active]) SELECT [CityID],[CityName],[CountyID],1 FROM [ElbalazoProduction].dbo.tbl_City SET IDENTITY_INSERT City OFF
-- State SET IDENTITY_INSERT [State] ON INSERT INTO Elbalazo.dbo.State ( [StateID] ,[State] ,[Active]) SELECT [StateID],[State],1 FROM [ElbalazoProduction].dbo.tbl_State SET IDENTITY_INSERT [State] OFF
-- NumberOfPeopleOption SET IDENTITY_INSERT NumberOfPeopleOption ON INSERT INTO [Elbalazo].[dbo].[NumberOfPeopleOption] ([NumberOfPeopleOptionID] ,[NumberOfPeopleNameOption] ,[Active]) SELECT [NumberOfPeopleID], [NumberOfPeopleName],1 FROM [ElbalazoProduction].dbo.tbl_NumberOfPeople SET IDENTITY_INSERT NumberOfPeopleOption OFF
-- DeliveryOption SET IDENTITY_INSERT DeliveryOption ON INSERT INTO [Elbalazo].[dbo].[DeliveryOption] ([DeliveryOptionID] ,[DeliveryOptionName] ,[Active]) SELECT [DeliveryOptionID], [DeliveryOptionName],1 FROM [ElbalazoProduction].dbo.tbl_DeliveryOption SET IDENTITY_INSERT DeliveryOption OFF
-- User SET IDENTITY_INSERT [User] ON INSERT INTO [Elbalazo].[dbo].[User] ([UserID] ,[FirstName] ,[LastName] ,[Address1] ,[Address2] ,[CityID] ,[StateID] ,[Zip] ,[PhoneAreaCode] ,[PhonePrefix] ,[PhoneSuffix] ,[Email] ,[CreateDate] ,[Active])
SELECT [CustomerID] ,[FirstName] ,[LastName] ,[AddressLine1] ,NULL ,[CityID] ,[StateID] ,[Zip] ,[PhoneAreaCode] ,[PhonePrefix] ,[PhoneSuffix] ,[EmailPrefix] + '@' + [EmailSuffix] ,[CreateDate] ,1 FROM [ElbalazoProduction].dbo.tbl_Customer SET IDENTITY_INSERT [User] OFF
-- EntreeOption SET IDENTITY_INSERT EntreeOption ON INSERT INTO [Elbalazo].[dbo].[EntreeOption] ([EntreeOptionID] ,[EntreeOptionName] ,[Active]) SELECT [EntreeOptionID] ,[EntreeOptionName] ,1 FROM [ElbalazoProduction].dbo.tbl_EntreeOption SET IDENTITY_INSERT EntreeOption OFF
-- CateringOrder SET IDENTITY_INSERT CateringOrder ON INSERT INTO [Elbalazo].[dbo].[CateringOrder] ([CateringOrderID] ,[UserID] ,[NumberOfPeopleID] ,[BeanOptionID] ,[TortillaOptionID] ,[CreateDate] ,[Notes] ,[EventDate] ,[DeliveryOptionID]) SELECT [CateringOrderID] ,[CustomerID] ,[NumberOfPeopleID] ,[BeanOptionID] ,[TortillaOptionID] ,[CreateDate] ,[Notes] ,[EventDate] ,[DeliveryOptionID] FROM [ElbalazoProduction].dbo.tbl_CateringOrder SET IDENTITY_INSERT CateringOrder OFF
-- CateringOrder_EntreeItem SET IDENTITY_INSERT CateringOrderEntreeItem ON INSERT INTO [Elbalazo].[dbo].[CateringOrderEntreeItem] ([CateringOrderEntreeItemID] ,[CateringOrderID] ,[EntreeItemID]) SELECT [CateringORder_EntreeItemID] ,[CateringOrderID] ,[EntreeItemID] FROM [ElbalazoProduction].dbo.tbl_CateringOrder_EntreeItem SET IDENTITY_INSERT CateringOrderEntreeItem OFF
select * from BeanOption select * from CateringItemIncluded select * from CateringOrder select * from CateringOrderEntreeItem select * from CateringOrderEntrees select * from City select * from Country select * from DeliveryOption select * from EntreeOption select * from NumberOfPeopleOption select * from [State] select * from [User]
Hi all, I hope you guys can help me with the following bit of T-SQL. I already have a solution but I really don't like it and I've been trying to find a simpler more elegant way of doing the same thing.
Firstly, let me present you with a brief explanation of what I am trying to do together with some sample data for you to play with and hopefully assist me in finding a better solution than the one I’ve come up with.
insert into #VehMake select 222, 'FORD' union all select 210, 'FORD (USA)' union all select 223, 'FORD (AUS)' union all select 269, 'HONDA' union all select 253, 'NISSAN' union all select 280, 'VOLKSWAGEN'
This contains various vehicle makes which I'm sure you'll recognise!
insert into #VehicleHistory (PersonId, VehMakeVehModel) select 1, 'FORD (USA) MUSTANG' union all select 2, 'HONDA CIVIC' union all select 3, 'NISAAN ALMERA' union all select 4, 'VOLKSWAGEN PASSAT'
As you can see, in the second table, the second column contains a string of the vehicle Make and Model in one string. What I need to do is to split the Make and Model in to separate columns with an update statement.
This seems easy enough with a simple LIKE comparison:
VehMakeVehModel like VehMake+' %'
....BUT if you notice, there are two records in the #VehMake table that are similar but not the same. These are the 'FORD (USA)' and 'FORD (AUS)'. The update statement would return two records from the #VehMake table when trying to match with the first record in my #VehicleHistory table.
As I said, I did come up with a solution but it seems over complicated and I have a feeling that there is a way of doing this with an update. Maybe use the LEN() function but I'm not sure.
Your help would be much appreciated.
BTW, once I've identified the correct Make, I can easily populate my model as all I have to do is use the replace function on VehMakeVehModel column and remove the matched make to get the full model name.
Hope that makes sense and thanks for any help in advance.
I am looking to perform a calculation and enter the reult into a field within my table. The fields that I need to base the calculation on are all in one table (SALARY). The fields are: SALARY and BASIC_HOURS and the result is to be entered into field HOURLY_RATE. The actualy calculation to be preformed is:
Hello, i am using Full text search for my web application search SP. i have used Contains for Exact search and Freetext for Any word kind of search. now i want to perform Like search using Contains. same behaviour which we can get using LIKE word. (e.g. Select * from tbl where field like 'abc%') even i have tried using contains(title,'"*Documen*"') . but its not working.
this is my code: 1 myconnection = new SqlConnection(kiemtraloi,chuoiketnoi); 2 mycommand.Parameters.Add(new SqlParameter("@mancc",SqlDbType.VarChar,10)); 3 mycommand.Parameters["@mancc"].Value = TextBox1.Text; 4 myconnection.Open(); 5 myreader = mycommand.ExecuteReader(); 6 if(myreader.HasRows) And when I click to start button, a error appear: NO overload for method 'sqlconnection' takes '2' argumentsI don't know what i must do :(, please help methx
My e-commerce site is currently running the following process when items are shipped from the manufacturer:1. Manufacturer sends a 2-column CSV to the retailer containing an Order Number and its Shipping Tracking Number.2. Through the web admin panel I've built, a retail staff member uploads the CSV to the server.3. In code, the CSV is parsed. The tracking number is saved to the database attached to the Order Number.4. After a tracking # is saved, each item in that order has its status updated to Shipped.5. The customer is sent an email using ASPEmail from Persits which contains their tracking #.The process seems to work without a problem so long as the CSV contains roughly 50 tracking #'s or so. The retailer has gotten insanely busy and wants to upload 3 or 4 thousand tracking #'s in a single CSV, but the process times out, even with large server timeout values being set in code. Is there a way to streamline the process to make this work more efficiently? I can provide the code if that helps.
Hi all, Lets say that i have 3 tables, they are already related together, information on each of the 3 tables and their relationship between eachother can be found below:I am using Microsoft SQL Server 2005 Database in Visual Web Developer 2008 using VB programming (ADO.NET)The 3 tables are as follows:
FloorRoomLocation
Fields inside each of the tables can be found below:
The Relationships between the 3 tables are as follows:
ID field in Floor table is referenced by the field named FloorID in the Room Table ID field in Floor table is referenced by the field named FloorID in the Location table
NOTE: Location Table serves only as an extension to Floor table thus they have a 1 to 1 relationship, due to My Projects Lead's instructions I am not allowed to consolidate the Floor Table and the Location Table as 1 whole table. Floor Table has a 1 to Many Relationship with the Room Table.
I Have already done the physical relationships between each of the 3 tables in the Database Diagram, in Visual Web Developer 2008 Express Edition under the Database Explorer
So i have created this form to accept user input:
this form is in a aspx page called AddRooms.aspx
Country Name:______________ (data sent to location table)
City Name:_________________ (data sent to location table)
Building Name:______________ (data sent to location table)
FloorID:[This is a DropDownList which is databinded to the Floor Table]
Room Name:_______________ (data sent to room table)
*Just imagine that the above is a form to accept user input
*With a hit of a submit button all data will be sent to their respective tables in the database
Now i know that i have to JOIN tables in my database in order for my application to work, but i have no experience performing JOIN, i need great guys like you to help me apply JOIN to the 3 tables mentioned above, do let me know if you have any doubts in what i am trying to do.
Do give me that code that i can either apply in the (VB environment Visual Web Developer 2008) and/or in Microsoft SQL Server 2005 environment
Just need the SQL Statment that i will need to construct to perform the JOIN i need to.
I want to build some paging functionality into my repeater (b4 you ask, datagrid not providing flexibility required for presentation).
I will have no problem with the VB logic but I will need to execute SQL that only returns results from x to y (e.g. results 21 thru 40 for page 2). I know I can do something like 'SELECT TOP 20 * FROM...', or something like it, for page 1. But, I'm not sure if it's possible to build SQL for the pages greater than 1. Any suggestions.
I had my IT dept. install sql server 2005 enterprise edition on a new windows server 2003. All other machines are running sql 2000 server on windows server 2000. I am a sa and local admin on all servers. I tried performing copy database, backup and restore and detach and attach to upgrade the sql server 2000 databases to 2005 and all fail. I followed all steps. I was imformed that IT installed sp2 for sql server 2005. It's like the servers dont talk to each other. Their all on the company's domain. I am wondering if something happen with the install but the IT dept. insist that everything went fine. It's strange that I can't perform a simple backup and restore it on the new server buy when I click on restore it doesn't let me browse to get the backup file on the 2000 server. I never had a problem in Sql 2000 with backup. Can it be the installation was corrupted somehow. It seems fine. I haven't created any new databases because I wanted to move the databases from sql 2000. Can anyone help me get a clue of what the problem is please?
Hi, Appreciated someone able to provide me some clu on how to perfom DBCC CHECKDB. Is it necessary to set the database to "Read only" before execute DBCC CHECKDB?
I had my IT dept. install sql server 2005 enterprise edition on a new windows server 2003. All other machines are running sql 2000 server on windows server 2000. I am a sa and local admin on all servers. I tried performing copy database, backup and restore and detach and attach to upgrade the sql server 2000 databases to 2005 and all fail. I followed all steps. I was imformed that IT installed sp2 for sql server 2005. It's like the servers dont talk to each other. Their all on the company's domain. I am wondering if something happen with the install but the IT dept. insist that everything went fine. It's strange that I can't perform a simple backup and restore it on the new server buy when I click on restore it doesn't let me browse to get the backup file on the 2000 server. I never had a problem in Sql 2000 with backup. Can it be the installation was corrupted somehow. It seems fine. I haven't created any new databases because I wanted to move the databases from sql 2000. Can anyone help me get a clue of what the problem is please?
hey guys--i need some expert advice!we have a Dell PE 2650 with 2GHz and 2MB RAM with 2000 Server. on it wehave about 6 MSSQL DB's. a couple of the DB's are the back-end for adecent sized web app (5-10 users on average, 20 users at most). manytimes, the cpu skyrockets on our db server when using the web app.sometimes things timeout, other times not. at this time, upgrading thehardware is not an option. aside from increasing the timeout periods, iwas wondering if windows 2003 server would utilize the processor better(even just a little bit?) enough to know the difference.should i attempt the upgrade, or is 2003 no more efficient withprocessor resources?thanks a bunch!
I'm working with ADO 2.8 en C++ with Visual Studio 2005. I want to perform a "select" in asynchronous mode. I don't really understand the logical of the recordset events. For example, I received a number of MoveComplete event higher than the number of rows in my recordset. It is really not clear for me ...
Does someone knows where I can find a a good example of C++ (or VB) code to manage select statements in asynchronous mode ?
Hi everyone! I am building a database in VC++2005 Express, connecting to SQL Server. I planed to add Delete function to a button, and when clicked, the data with the specific ID according to the IDTextBox->Text would be deleted from the table. However, nothing happened. I don't know what's wrong with my program.
I have two versions of the same dataflow component , i need to use the new version component in the packages created using the old version . How can i do this using the perform upgrade method .
Hello Friends. I have few doubts regarding the use of Sqldatasource server control. Is the control flexible enough to achieve these things:- 1.To perform complex queries using Sqldatasource. For eg:- using JOIN to retrieve/insert data from/into multiple tables.2.Performing cascading dropdownlist using sql database as datasource.3.Performing For loops eg:-populating the multiple items into the listbox from sqldatasource. and retrieving them at once.4.use ajax update panel.etc.any example/sample on how to achieve these task?thanks.jack.
Update [table] Set collumnName = Substring(collumnName, 1, 2) = '11' AND Substring(collumnName, 3, 5) = '00000' Where (conditional statement)
SQL is not letting me perform the update because of the AND statement between the two Substring's. Is there anyway around this...is there anything else I can do to acomplish what I'm trying to do.