|
Also forgot to mention, The process was really heavy, now just lloking into sql script to do the final job and do not want to do it via code.
|
|
|
|
|
First, find out if this is really a big issue:
SELECT
REPLACE([ProductName],'_','') AS NewName,
COUNT(*)
FROM
[Product]
GROUP BY
REPLACE([ProductName],'_','')
HAVING
COUNT(*) > 1
You may find that you have only a few rows that you can manually update/delete prior to the move.
Next - what are you going to do with the new duplicates? Are you not bringing them over or do you want to generate a unique name for them or are you going to do some fancy merge of the other columns/linked tables?
|
|
|
|
|
we are making/filling a new table and after filling that with the desired table, the previous table is a subject to delete, so will not do anything regarding the duplicates ( They stay to be deleted )
Do you know how can I use Select / Insert here to accomplish this task and bring all the columns data with a condition checking about preventing the insertion of future-probable-duplicates ?
There are about 180,000 rows which we will not move about 10,000 of it,
The database is generated by code, and everything was based on decision and observation.
|
|
|
|
|
Something like this should work:
INSERT INTO [NewProductTable]
(
[NewProductName],
[NewCol1],
[NewCol2]
)
SELECT
REPLACE([ProductName],'_',' '),
[Col1],
[Col2]
FROM
[Product]
WHERE
(REPLACE([ProductName],'_',' ') = ProductName) OR
(REPLACE([ProductName],'_',' ') NOT IN (SELECT [ProductName] FROM [Product]))
I want you to understand that any child records (think foreign key) based off the ignored rows will be orphaned in the new structure.
|
|
|
|
|
I think the logic should be almost right,
except a piece which I have a little doubt in the 'Where' condition
in addition to my never-ending doubt on SQL CE,
let me try it and give you the feedback of your code,
Thanks @Michael Potter, your help is really appreciated,
that is the last step regarding the database
and I hope it could help on the objective desired.
|
|
|
|
|
Hi,
Some time back my machine (Win XP) got renamed from M4B-11-720-GXP to M4B-06-425-GXP. While inatalling MS SQL Server 2005 SP3, the installer still shows me the old Reporting Service instance name - M4B-11-720-GXP\ReportServer. As a result installation fails on the authentication windows since there is no such instance present on my machine. Is there any way to get rid of this issue? From where does it load the old instance name? Can we change that? Also is there any way to unselect the "Reporting Services" option from the previous screen?
Your prompt response on this would be highly appreciated.
Thanks in advance.
Regards,
Vipul Mehta
modified 16-Jul-12 5:04am.
|
|
|
|
|
i am bigineer plese give me the login page code
|
|
|
|
|
Hi Dinesh,
First please let us know the programming language you are using for login page. second the design of login page.
Thanks
https://sites.google.com/site/freelancermanisha/
|
|
|
|
|
It doesn't work like that around here. We don't just give out code. You should really try working on your own code and when you run into any problems with it, then ask.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello .
I know that a SQL login is used to log into the server and SQL user is used to log to database but i want to know that is their a 1 to 1 correspondence between a SQL Login and SQL user or a login can have more than one SQL user that can be mapped to it.
Thanks
|
|
|
|
|
yousefshokati wrote: user that can be mapped to it.
How are you mapping a user to a login? As a SQL login consists of a user name and a password how are going to know if a user has not shared that information.
We use integrated security for the developers, applications has their own sql identities and pass in the workstation id and no other connections are allowed!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am asking only that
A SQL User (database -level security) must map to a login . It is very obvious .Now I am only asking you that can a login have more that one database-level user ?
We know that a Login and a user are related with each other by SID Ok? Now i want to know that is it possible for a login , that can have nmore than one user ?
|
|
|
|
|
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.
|
|
|
|