|
try this
create table<table name>(<br />
<field1> <datatype>,<br />
<field2> <datatype>,<br />
<field3> <datatype>,<br />
..................,<br />
..................,<br />
..................,<br />
<fieldn> <datatype><br />
)
|
|
|
|
|
Hello,
Thanks for your replies
I am using this in Access.The statement
Create Table Sales (Amt decimal(10,2)) is written in Access.
I get the error Syntax error in field definition.
Prithaa
|
|
|
|
|
Message: Clicking on the following menu items does nothing.
View -> Server Explorer
Tools -> Connect to database
Tools -> Connect to server
Please advise.
Manish Ganguly
|
|
|
|
|
hi
presess Ctrl+Alt+S
try it..
|
|
|
|
|
Hi joe,
tried it. no luck.
What is it suppose to do?
Manish
|
|
|
|
|
FINALLY GOT IT....
HAD TO TYPE THE FOLLOWING IN THE COMMAND PROMPT
devenv /resetskippkgs
|
|
|
|
|
hi do u try this key (ctrl+alt+L)
|
|
|
|
|
hey all,
I think this is more problems with the computers i am working on, i don;t have administrator rights, rather than the database itself...
I have a database file that i would to have as many applications to access it as possible, but the problem is since i don't have the rights the sql server reportst that under default configurations remote connections cannot be established. However when i add it to each individual application is added it and works fine.
My question is, is there a way i can have a central database as i would do if i could have sql server running?
I am using C# as the programming language.
Thanks all,
Best regards...
Luis E Tineo S
|
|
|
|
|
You mean, you wanna host the SQL database locally, right?
If you are using SQL 2000, you can install MSDE on your Windows 2000, XP. or you can install SQL server if your OS is the server-type (e.g. Windows 2000 Advanced Server or Windows 2003)
If you are using SQL 2005, you can install SQL 2005 Express (Advanced setup that includes the Management Studio) on your Windows XP or Vista.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Let's say there are three tables (Customers, Stocks, CustomersStocks) in my database.
Customers
- CustomerID
- CustomerName
Stocks
- StockID
- Stockname
CustomersStocks
- CustomerID
- StockID
My question is ~ How can I get the list of customers who own all stocks?
For example, I have the data as below ~
Customers
- 1 | Michael
- 2 | Julia
- 3 | Lilian
Stocks
- 1 | Apple
- 2 | Orange
CustomersStocks
- 1 | 1
- 2 | 1
- 3 | 1
- 3 | 2
- 1 | 1
I wanna get the list of customers who own all stocks. In my example, the result will be "Lilian" . (should NOT include "Michael" as he doesn't own all stocks and he just own one stock twice.)
I wrote this SQL query below ~
<br />
SELECT DISTINCT dbo.Customers.CustomerName<br />
FROM dbo.CustomersStocks INNER JOIN<br />
dbo.Customers ON dbo.CustomersStocks.CustomerId = dbo.Customers.CustomerID<br />
WHERE STOCKid <br />
GROUP BY dbo.Customers.CustomerName, dbo.CustomersStocks.StockID, dbo.CustomersStocks.CustomerId<br />
HAVING (dbo.CustomersStocks.StockID =<br />
(SELECT COUNT(*) AS CountOfStock<br />
FROM dbo.Stocks))
It works okay.. but the customer who own a stock twice (e.g. "Michael" in my case) included in the result.. This is the problem..
So, How can I get the list of customers who own all stocks?
Thanks in advance.
|
|
|
|
|
You probably need to create a view of CustomersStocks that contains only a single entry for each customer instead of the multiple entries. Perhaps a select distinct might do it.
create or replace view uniquecustomersstocks as
select distinct customerid, stockid from customersstocks
;
|
|
|
|
|
Actually, I don't want to create a view to get this result.. I think that it is possible to get the result with one line (maybe..big line) of SQL
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
One way of doing this would be:
1) CROSS JOIN Customers with Stocks to get every possible combination of customers and stocks.
2) Do a LEFT JOIN between 1) and CustomersStocks. Get a DISTINCT list of the Customer IDs where there is no matching record on the RHS of the join. These are the customers who have not bought at least 1 of the available stocks.
3) Return the records from Customers where the Customer ID is NOT IN the set of records returned in 2) These will be the customers who have purchased all available stocks.
Hope this helps.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks... I will try and will let you know..
pmarfleet wrote: 1) CROSS JOIN Customers with Stocks to get every possible combination of customers and stocks.
This line will be the same as all data from CustomersStocks.
pmarfleet wrote: RHS
RHS stand for?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Michael Sync wrote: This line will be the same as all data from CustomersStocks.
No it won't. CustomersStocks contains combinations of customers and stocks where the customer has bought the stock. Cross joining Customers and Stocks returns the cartesian product of the two tables, ie. every possible combination of customers and stocks regardless of whether a customer has actually bought the stock. The purpose of this is to compare the difference between this set and CustomersStocks to find which customers have not bought at least one of the available stocks. Once you have identified these customers, by process of elimination you can find the customers who have bought all available stocks.
Michael Sync wrote: RHS stand for?
Right-hand side.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
i want to write stored procedure insuch a way where in it has to return the table name used stored procedure.
for example
create procedure proc1
as
begin
select * from student
end
once u exit exec proc1 it has return the table name used i.e "Student"
could you please help in doing this.
or it is possible in sql.
reply me soon at suhailquadri@gmail.com
Suhail Ahmed Mohammed, Application
Engineer,
Cybernet Slash Support
|
|
|
|
|
I don't think there is any way to do this. Besides, is it necessary? Stored procedure are usually coded to select data from a particular table or tables. You would know which table(s) each stored procedure used, so you could use an OUTPUT parameter to return a varchar value which was hard-coded to that table name for each stored procedure.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
well using sp_depends storedprocedurename , it will list all the details of a stored procedure.
|
|
|
|
|
This returns the query plus a table with 1 row - 1 column that contains the table name. Seems like a waste of time since the developer already knows the table name.
CREATE PROCEURE proc1
AS
SELECT
*
FROM
student
SELECT
'student'
|
|
|
|
|
Michael Potter wrote: Seems like a waste of time since the developer already knows the table name.
It is.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
you need to access the information about stored procedure dependencies written by another dba.
I m displaying the information of stored procedure dependencies using sp_depends procedurename.
It was requested by one of my client.
Now programmetically i dispalyed in table and displayed accordingly.
|
|
|
|
|
Thanks i got the solution.
|
|
|
|
|
Please help me in tuning stored procedures. I want step by step explanation in detail
Pavan Kumar
|
|
|
|
|
Hi,
Pavan, it is not a pre-defined process. All you need to do is to take care of code that is not required, or that can me optimized. Though DBMS will optimize it, but only you can tell if the task being done is required or not.
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
This [^]and this[^] article might help.
Deja View - the feeling that you've seen this post before.
|
|
|
|