|
Ah, more context...
Yes a user can have many connections, an example would be using SSMS each query window creates it's own connection using your credentials. If, in SSMS, you look at the activity monitor you will find multiple SID per login.
You terminology is difficult, what do you mean by a User. A database is only interested in a connection, each connection has credentials. A set of credentials (presumably your User) may login multiple times.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Principals are entities that can request SQL Server resources.
SQL Server Login is SQL Server-level principal
A database user is a principal at the database level.
One Login can be associated with many users (one per database).
Thanks
https://sites.google.com/site/freelancermanisha/
|
|
|
|
|
|
yes an SQL login can be mapped to more than one DB user. Picture an SQL login as an access to a building while a DB user provides specific access to rooms in the building.
No access to the building (Login) then no access to the rooms (DB user).
|
|
|
|
|
Hi,
How to sort this sample data and query below by quantity and by category?:
Select Qty, Category From Inv1 Order By Qty Desc, Category
Qty Category
65 Cat3
55 Cat3
50 Cat2
45 Cat3
40 Cat1
30 Cat1
25 Cat1
25 Cat2
15 Cat1
15 Cat2
so that the output would be look like this:
Qty Category
65 Cat3
55 Cat3
45 Cat3
50 Cat2
25 Cat2
15 Cat2
40 Cat1
30 Cat1
25 Cat1
15 Cat1
Thanks in advance!
Hardz
|
|
|
|
|
Perhaps ORDER BY Category,Qty DESC ?
|
|
|
|
|
Select Qty, Category From Inv1 Order By Category DESC, Qty DESC
|
|
|
|
|
Hi,
Thanks for the reply, but what I want to accomplish is that to determine the highest Qty then prioritized the Category that has the highest Qty, from this sample Cat3 contains the highest Qty(65) then sorted from high to low, next is Cat2(50), and Cat1(40). If I changed for ex. the Qty at cat1(40) to 95 then Cat1 now is the first priority of sorting, then Cat2 and so on, so the sorting may varies from high to low no. of Qty per Category, not by Category per Qty.
Regards,
Hardz
|
|
|
|
|
This works fine for SQL Server:
SELECT Qty, t1.cat FROM Inv1 AS t1
INNER JOIN
(SELECT MAX(Qty) AS mq, cat FROM Inv1 GROUP BY cat) AS t2
ON t1.cat=t2.cat
ORDER BY mq DESC, Qty DESC
However, you didn't fully specify what you want: when two categories have equal maxima, what should happen? The above may intertwine such categories!
This wouldn't:
SELECT Qty, t1.cat FROM Inv1 AS t1
INNER JOIN
(SELECT MAX(Qty) AS mq, cat FROM Inv1 GROUP BY cat) AS t2
ON t1.cat=t2.cat
ORDER BY mq DESC, cat, Qty DESC
|
|
|
|
|
Hi Luc,
Your 2nd code worked perfect for me, coz you're right for your assumption that when there's an equal maxima between these categories it will automatically sorted by category.
Thank you very much.
Regards,
Hardz
|
|
|
|
|
Hi everyone
Is it possible to create a database of "Data Source configuration wizard"?
let me explain you select it from Data->Add New Data Source in the visual studio and then you select Database in "Choose a Data Source Type" after select "DataSet" you have to make a "Add Connection" this window has an item "Connect a Database->Select or enter a database Name",Is it possible to create a database instead name of a database?
|
|
|
|
|
messages wrote: Is it possible to create a database instead name of a database?
No. It's a datasource configuration wizard. It's expected that database is pre-defined. Create your database from before and then configure it using the wizard.
|
|
|
|
|
Hi Friends..
I want to know should i Make new database after Financial year or just create new session in the current database .
Please tell me with reasons.
|
|
|
|
|
How on earth can anyone answer this question without knowing anything about your business?
|
|
|
|
|
The idea to start a "new" database comes from an accountant, not a technician; a new year means a new book, a new page, a clean slate to them.
In a database, that's just silly. Include a date on the record, and you can select/manipulate the data is if you were working in a database with only data from that particular year (thanks to the WHERE clause)
Advantages include;
- Easy maintenance (one database, as opposed to 20 clients with 4 years worth of databases)
- Easy backups (since all is in one database)
- Easier cross-querying (summing the data over multiple years)
- Easier to understand (KISS applies to almost everything, everywhere)
The only disadvantage is that the accountant won't understand why you put the data in the "same books". That's the reason why they're not involved when creating a technical storage-facility, only when describing the data - they may explain what they need, but can hardly explain how it should be stored.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
No, but you could have tables where you summarize various periods for future comparisons and such.
|
|
|
|
|
I want to generate Excel Worksheet through a SQL Query fired on the table directly export data to an Excel Sheet.
- Happy Coding -
Vishal Vashishta
|
|
|
|
|
No, you really don't. Excel is the devil's workshop.
I prefer to generate XML, it's more flexible. It can also be converted to CSV which Excel can read.
|
|
|
|
|
vvashishta wrote: I want to generate Excel Worksheet through a SQL Query fired on the table directly export data to an Excel Sheet.
..and?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Do I need a license to deploy SQL CE to my CE devices for commercial use? I heard it's free but am not sure about it.
Best,
Jun
|
|
|
|
|
Why not check with Microsoft, it's their product.
|
|
|
|
|
It is free for commercial use;
SQL Server Compact 4.0 is freely redistributable under a redistribution license agreement and application developers redistributing SQL Server Compact 4.0 can optionally register at the SQL Server Compact redistribution site. Registering will help the developers in getting information about SQL Server Compact critical security patches and hot fixes that can be further applied to the client installations.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Display the last name of all employees who have an 'i' and an 'n' in their last name.
IS THIS STILL AN SQL WILDCARDS WITH A COMBINATION OF AN AND? SIGH..PLS. HELP..
|
|
|
|
|
|