|
hey guys,
How can i get the values oif multiple columns in rules? I was Googling up rules and all i could find was the method to use single column. Let me give you an example:
In an table i have many columns, three of which are X,Y & Z. I want to create a rule that checks if the sum of three columns are greater than 1000. If i do manage creating a rule and bind it to column X - how do i access the value of Y and Z from my Rule. Could some give explain. A peice of code would be really helpful.
Thanks.
|
|
|
|
|
I wanna ask a question bout datareader and dataset.
If i execute 1 Sp with 2 queries in it as
select * from employee
and
select * from Company bothe
this SP's result i execute in dataset as well as datareader at a time. so what o/p it will show in each -datareader and dataset ?
JAX
|
|
|
|
|
Jax_qqq wrote: so what o/p it will show in each -datareader and dataset ?
It will show the same output unless the database changed between runs.
DataReader provides a forward only view of the data. The DataSet is a container that is used by a Data Adapter so that the result set can be accessed in a random access within the application.
|
|
|
|
|
Hi,
I want to run Job using any command prompt utility. Such type of utility is there in SQL Server 2000?
I know about DTSRun.exe is used to run DTS package, but I want to run Job as a whole.
Thanks.
modified 15-Sep-13 3:09am.
|
|
|
|
|
You mean the OSQL command line utilty?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How ca i remove spaces in my database ?
my database : visualfoxpro 6.0
CDatabase_Name::CRecordset
(MFC)
col1 = "name"
col2 = "city"
col3 = "country"
tank you in advance !
Bravoone
|
|
|
|
|
How to reset a database's identity value to 0, after deleting all rows from a table.
FIRE
|
|
|
|
|
I don't know the exact way but one workaround is there. You change that column identity to no and again reset it to yes, next time it will start from one.
Best Regards,
Apurva Kaushal
|
|
|
|
|
|
I not sure is there way to show percentage of my sales.
I have done a SQL on showing the total sales and now i want to calculate the percentage of total for each department. Example
TOTAL sales= $100
Vendor1 =$20
Vendor2 =$10
........
how can correctly show another column that will calculate the percentage?? I have try many method but not working... i was thinking to write as
sum(ti.totalsales)/sum(sum(it.totalsales))*100 as precentage
is SQL able to support those complicated calculation? or i have to do it in vb...
---HEre is the basic show the total sales with out percentage...
select d.deptdesc,v.[name],ti.deptcode ,sum(ti.totalsales) as Total from
tot_item ti , dept d, item i, vendor v
where ti.itemcode=i.itemcode and v.vendorid=i.vendorid and
ti.deptcode=d.deptcode
group by v.[name], ti.deptcode, d.deptdesc
ORDER BY v.[name], ti.deptcode ASC
|
|
|
|
|
The sample query you list has both Department and Vendor in it (you could get departments listed more than once if they use different vendors). You are trying to get a percentage of total for each department but your sample result set lists no percentages and values are listed by vendor. Are you sure you know what you really need?
Given your 2nd line and assuming you are using SQL Server, first calculate a good total sales per department.
SELECT
d.deptdesc,
SUM(ti.totalsales) AS DeptTotal
FROM
tot_item ti
INNER JOIN
dept d
ON (ti.deptcode=d.deptcode)
Now write a query that calculates total sales.
SELECT
SUM(ti.totalsales) AS FullTotal
FROM
tot_item ti
Now put them together
SELECT
dep.deptdesc,
(dep.DeptTotal /
(SELECT
SUM(ti.totalsales)
FROM
tot_item ti)) * 100 AS PercentOfSales
FROM
(SELECT
d.deptdesc,
SUM(ti.totalsales) AS DeptTotal
FROM
tot_item ti
INNER JOIN
dept d
ON (ti.deptcode=d.deptcode)) AS dep
ORDER BY
deptdesc
Note: I am using a more modern form of the JOIN syntax. There are issues with expressing the JOIN in the WHERE clause. You can make this a lot cleaner using variables in a stored proc.
|
|
|
|
|
Sorry - forgot the GROUP BY clause in the aggregate:
SELECT
d.deptdesc,
SUM(ti.totalsales) AS DeptTotal
FROM
tot_item ti
INNER JOIN
dept d
ON (ti.deptcode=d.deptcode)
GROUP BY
deptdesc
This will also need to be modified in the final query.
|
|
|
|
|
You can try something like this:
DECLARE @TempTotal int
SELECT @TempTotal=sum(ti.totalsales) from ti
select d.deptdesc,v.[name],ti.deptcode ,(sum(ti.totalsales)/@TempTotal) as Total
from
tot_item ti,
dept d,
item i,
vendor v
where
ti.itemcode=i.itemcode and
v.vendorid=i.vendorid and
ti.deptcode=d.deptcode
group by v.[name], ti.deptcode, d.deptdesc
ORDER BY v.[name], ti.deptcode ASC
|
|
|
|
|
Hey all,
I'll open with an example:
Lets say I have a table of students...
I can represent each line in the table as a class, which I'll write.
This Student class would contain all of the fields in the table as properties, and maybe a few more functions.
So now lets say I have another table of classes, and I want to write a complex query, which takes information from both tables.
How can I represent this kind of stuff as classes?
Thanks in advance,
Shy.
|
|
|
|
|
It could become something like your Class object having a collection of Student class objects.
|
|
|
|
|
Hi,
Is there any inbuilt function in SQL 2005 which checks whether referential integrity exist in any other table for an particular master record?
Regards,
Vipul Mehta
Sr. Software Engineer
NIIT Technologies Ltd
|
|
|
|
|
sp_helpconstraint stored procedure returns the constraints on the table.
Ex:
sp_helpconstraint ele_Examination
|
|
|
|
|
how to insert 3 webforms controls data to a sql database in asp.net Just posted ?
hi
i have 3 webforms.In first webform we have 2 textbox ,one is user id and other is password.then there is a continue button.page go to second webform.
in second we have two textbox.one is username and age.and again we have continue button.page go towebform3.again we have 2 textbox,one is use hobbies and user favorite food,here we have submit button.
When we clik submit button,it should get inserted in one table in database.
After clicking submit button he felt that he has to chage some thing(for eg change usrid or password) ,he goes to firstpage from third page and changes then he goes to third page and click submit and now it should be upadated.
thank you.
bye
md riyasath ali
-- modified at 1:20 Monday 25th September, 2006
|
|
|
|
|
riyasath wrote: Expecting anser very quickly
Code Project members do not respond nicely to statements like this.
|
|
|
|
|
// *** Setup DataAdapter with expicit INSERT, UPDATE,
// DELETE "Template" Commands.
private void InitializeCommands()
{
// Reuse the SelectCommand's Connection.
SqlConnection con =
(SqlConnection) _dataAdapter.SelectCommand.Connection;
// Create an explicit, reusable INSERT command
_dataAdapter.InsertCommand = con.CreateCommand();
_dataAdapter.InsertCommand.CommandText =
"INSERT INTO customers " +
"(CustomerId, CompanyName, ContactName, ContactTitle, " +
"Address, City, PostalCode, Phone) " +
"VALUES(@CustomerId, @CompanyName, @ContactName, " +
"@ContactTitle, @Address, @City, @PostalCode, @Phone)";
// Bind parameters to appropriate columns for INSERT command
this.AddParms(_dataAdapter.InsertCommand,
"CustomerId", "CompanyName", "ContactName", "ContactTitle",
"Address", "City", "PostalCode", "Phone");
// Create an explicit UPDATE command
_dataAdapter.UpdateCommand = con.CreateCommand();
_dataAdapter.UpdateCommand.CommandText =
"UPDATE customers " +
"SET CompanyName = @CompanyName " +
"WHERE CustomerID = @CustomerId";
// Bind parameters to appropriate columns for UPDATE command
this.AddParms(_dataAdapter.UpdateCommand, "CompanyName", "CustomerID");
|
|
|
|
|
hi
u did not get my doubt.
I have 3 webforms with two textbox each.in every form there is continue button except for last form where there is submit button.In the third webform when we click submit then all the webforms i.e firt,second and third data should go to database.continue takes to next webform.
After clicking submit ,if he feels he has given some wrong information in firt form,then he click back button in the browser and changes,then it should get updated
thanks in advance
riyasath
|
|
|
|
|
This is more of an ASP.NET question, and you should probably be storing the intermediate results from the first two forms in Session state.
|
|
|
|
|
hi
Thank's for ur reply.
iam new to .net.
can u plz explain the answer briefly.
my another doubt is by using dataadapter can we insert the data in database.?
My another question is by using dataset,where there is a emp table in it, and i want a denpno =10 whole record .how to get that complete record.
Thanks in advance
Byee
riyasath
|
|
|
|
|
Hi all,
I need to know what are my choices to implement the following:
I have a table named "PostedJobs" with a "Status" bit(Open/Close) field. When an Employer posts a job this bit field will be set to Open - on an Employer-chosen specific date this bit field will be set to Close. Then this job(row) must be deleted from "PostedJobs" and inserted into another table named "ClosedJobs" where I keep a log of old posts.
Now, is there any chance to automate the whole process?
Thanks in advance
|
|
|
|
|
If you are using SQL server you can use Sql Server Agent to periodically (say once a day at 00:00:1) run a job (stored procedure). The stored proc could check a table of Jobid/closeDate records and close out any jobs due for closure... if not SQL, then maybe use windows scheduler to run an exe that does the same thing(with or without a stored procedure).
|
|
|
|