|
hi Friends i have a problem
i have a two tables
1.Customer
2,Purchases
customer table has [ Customer_id(int),name(varchar)]
purchases table has [ purchase_no(int)(identity),Customer_id(int),Delivered(bool)]
i will all the custmor_id's in string format
and i want to update the delivered field in the purchases table with bool =1 and
customer_id with split function
i am using this query - where fnSlplit is spliting the customer_id
into table format but not updating the purchases table
UPDATE purchases SET Delivered= 1
INNER JOIN dbo.fnSplit(@CustomerList,',') AS S
ON
REDEMPTION_CODE = S.ID
WHERE REDEMPTION_CODE = S.ID
please help to solve this problem.
|
|
|
|
|
I could be wrong, but I think you need to do the split function first, store that in a variable, and then use that variable for the update. You have S.ID in the inner join and in the where clause--you need one or the other.
I have not tried this, but something along these lines:
DECLARE @newCustID VARCHAR(10)
SET @newCustID = dbo.fnSplit(@CustomerList,',')
UPDATE purchases SET Delivered = 1
WHERE REDEMPTION_CODE = @newCustID
Hope it helps.
|
|
|
|
|
Which Version of SQL Server are you using.
In SQL Server 2008, you can pass Table Value Parameter to your stored procedure and in such a case no need to pass delimited string of ID's.
If not, you need to create a Table Variable and store the IDs in the Table Variable first using the Split UDF and then use the same in the statement. Also you can iterate through your table of IDs and then update the purchases table.
|
|
|
|
|
Hi
This is Mahesh, working as a technical Lead for performance testing & engineer activities.
Currently I am working on e -learning application which was developed in .net & Classic ASP.
During performance testing I am facing some issues with MSMQ performance for overloaded of messages.
I need to monitor the applciation for MSMQ is there any freeware performance monitoring tools available in the market.
What are basic performance counters needs to monitor for MSMQ?
If anyone has the exp in MSMQ please share with me.
I am awaiting for your kind response.
Thank you,
Mahesh
|
|
|
|
|
Google MSMQ Monitor--you will find lots of helpful results there.
|
|
|
|
|
hi all,
this is my oracle StoredProcedure
PROCEDURE PEAP_SelectActiveYear
(
Cur_RCT1 OUT GLOBALPKG.RCT1
)
AS
BEGIN
OPEN Cur_RCT1 FOR
SELECT ActiveYear
FROM PeapParameters;
RETURN;
END;
in the code am trying to fetch the value using ExecuteScalar()
but not retrieving
Anything need to be changed to the procedure?
|
|
|
|
|
I don't use Oracle but try removing the RETURN, this should then get the result set back instead of trying to RETURN any output parameters (of which there are NONE).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello brothers
Just i m designing for helpdesk product.
jsut think about . i have one department
Department(Admin)
.
.
...... SupportTeams ( Support Teams having Support Users)
.
........ SupportUser1
.
........ SupportUser2 and so....
User Team1(Means developer)
,
......User1
.
..... User2
User Team2(Means developer)
,
......User1
.
..... User2
Now my question is i want to give security for this tree structure.
..> Department Admin can access to all Like Support Teams and USer teams.
..> Support Teams can Access to Only Userteams Member.
..> Userteams Member can aceess only his profiles.
Now can u tell me how could i create table for these flow tree structure.
Some Thing need 2 do NEW
|
|
|
|
|
What best you can do is to create one table like
ID DepartMent DepartMentData
and make DepartMentData column as xml type where you will store data in
the hierarchal way.
For eg.
There is an admin department so the DepartMentData column may have values like
<Department Name = "Admin">
------<SupportTeams>
----------<SupportUser Name ="SupportUser1" ID="1">
--------------<DeveloperTeam1>
------------------<User Name ="Dev1User1" ID="1"/>
------------------<User Name ="Dev1User2" ID="2"/>
--------------</DeveloperTeam1>
----------</SupportUser>
----------<SupportUser Name ="SupportUser2" ID="2"/>
--------------<DeveloperTeam2>;
------------------<User Name ="Dev2User1" ID="1"/>
------------------<User Name ="Dev2User2" ID="2"/>
---------------</DeveloperTeam2>
-----------</SupportUser>
------</SupportTeams>
</Department >
Now in C# code you could pass the element you want to read Like for eg. you want to read all the users below SupportTeams then you just need to
call:
XmlNodeList ChilNodes = doc.GetElementsByTagName("SupportTeams")
This will return all the child nodes including SupportTeams node.
Now you can iterate through for each node
foreach (XmlNode cNode in ChilNodes )
{
}
In the loop check that each node has further any child node by calling:
if(cNode.ChilNodes!= null)
This way you could ensure that you have not gone to above in the tree hierarchy.
This will always go to below in the tree hierarchy.
|
|
|
|
|
If you are using SQL 2008 (you don't mention the database) look into the hierarchy ID and it's methods.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hi I have created tables with their primary keys as integers. How can I write a statement to Alter the primary key and set the identity (autonumber) on it in SQL Server?
Thanks
|
|
|
|
|
ALTER TABLE MyCustomers ALTER COLUMN CustId IDENTITY (100,1);
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
hi all,
ID NAME
1 aaa
2 bbb
3
4 NULL
From this table how to retrieve the records with name <> null or empty using oracle query?
i should get the result like this :-
1 aaa
2 bbb
how can i do this?
|
|
|
|
|
Select ID, NAME from [table name]
where NAME IS NOT NULL
AND NAME != ""
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
giving error:-
PL/SQL: ORA-01741: illegal zero-length identifier
|
|
|
|
|
That error because of the following statement
AND NAME != ""
If space is there in the column you can check like this,
Name != " ";
and oracle treats the empty string ('') as null.
refer here[^]
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
thanks for ur reply..
its exactly bcz of the space...i gave like <>' ' it worked...
|
|
|
|
|
gt this table address with fields name,housename,post,genderid.i'm taking genderid from another table-gender.Now how to insert something to address table?
|
|
|
|
|
Do you want to insert genderid from gendertable into table address?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
If you are using stored procedure then inside the procedure...
Insert into dbo.tblAddress
Select @name,@housename,@post,genderid from dbo.tblGender where [some condition to get the specific gender] --@name,@housename,@post can be input paramaters to the stored procedure
Alternatively, you can query the gender table to get the gender and store in a variable and then use the same to insert data in the address table.
However the first approach is better...
|
|
|
|
|
Hi,
I need some experienced advise on a situation that i am facing. Please provide help.
I have a products excel sheet. currently 20,000 products but they keep on increasing. i am asked to develop the sql tables. the products can be divided into 2 types. One type have about 30% rows whereas other will have 70%.
In database implementation, i can have one table with type field which separte the 2 types also I can have 2 different tables for both types.
My question is :
Between the two, for searching purposes which proves the best one.
ie. on average 1 table search provides better performance or 2 tables provide better performance.
thankyou
|
|
|
|
|
Hard to say whether you will get better performance with searching 1 large table or 2 smaller tables without knowing the details, but with the number of records you are talking about (less than 100,000) you will be amazed at how fast SQL server can return results from a query compared to searching in Excel.
My suggestion is to store the data in one table, with a "type" idicator. Creating the proper indexes will also improve performance depending on the nature of the query.
Question: Do all of the columns for each product "type" apply ? Another way of asking this question is that if you created 2 tables; one for each product type, would they have the same columns ? If so, then for sure, go with 1 table and an idicator field.
BTW: What type of application will be accessing this data ? ASP.NET or a Windows client application ?
|
|
|
|
|
Thankyou for responding
Do all of the columns for each product "type" apply?
theoretically , both should have same detail. but does the number of columns matter. What i mean is that if product has 12 columns and i split it into two tables.
1. productname
2. productdetail
would select statement make a difference? to my knowledge, its the same thing.
the application would be used by asp.net. Also if u don't mind, it would be nice if u mention whether its wise to use mysql db or sql server db. is sql server n asp.net better, or is sql server or php better, or asp.net n mysql or other way round.
Thanks again.
|
|
|
|
|
Better go with a single table with a bit field for product type.
Maintaining 2 different table for the same identity is not a good dB design practice.
The performance wont be an issue with the size of record that you are saying.
Implement indexes on the columns that you will use in the query conditions.
Now regarding the selection of database, for ASP.Net, better go for MS-SQL Server. As .Net framework provides native driver for MS-SQL Server. This is the managed driver and performance is better.
However, the hosting cost for MS-SQL Server is higher, if budget is a constraint, you can go for mySQL.
|
|
|
|