|
What are you going to do if the record is updated rather than added?
|
|
|
|
|
Also Access has a Guid datatype.
CREATE TABLE [SAC_MEMBERSHIPS]
(
[id_memberships] GUID NOT NULL PRIMARY KEY,
...
|
|
|
|
|
I use
id_memberships GUID PRIMARY KEY DEFAULT GenGUID() NOT NULL
But I can do in Update Request SQL
Have you an idea how do the Update ?
|
|
|
|
|
how do download a excel file from a website by using that website url(.csv) in c# code, in design section file shuld download on a button click and save in my system tell me the full procedure
|
|
|
|
|
This is not a question that can be answered in a few lines. You need to go and research some of the libraries that can be used to download files.
|
|
|
|
|
I JUST WANT PROCEDURE NOT A CODE OR SOMETHIN ...
|
|
|
|
|
The procedure is:
- Collect requirements
- Research tools and libraries
- Write code
- Test, diagnose problems, and correct errors.
- Repeat above until working
|
|
|
|
|
Let me add another important step to Richard's answer:
divide and conquer
Split the problem into smaller pieces until you can solve each of those smaller pieces. If you can't solve it yet, try to split it further.
In case you are later stuck with a specific problem, come back to this site and ask a specific question.
|
|
|
|
|
Hi,
I would like to ask how can I delete duplicate records in MySQL from my fingerprint table.
I need to delete any record if found the same created_date AND created_time AND employee_number
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
Don't use MySQL but in SQl server you would do this:
WITH CTE_fingerprint
AS (
SELECT
employee_number
,created_date
,created_time
,ROW_NUMBER() OVER (
PARTITION BY
employee_number
,created_date
,created_time
ORDER BY
employee_number
,created_date
,created_time
) AS RowNumber
FROM [fingerprint]
)
DELETE
FROM CTE_fingerprint
WHERE RowNumber > 1;
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Not sure with self-joins in MySQL.
This query should show you all the duplicates (assuming ID is the identifier in the table):
SELECT *
FROM fingerprint t1 inner join fingerprint t2 on
t1.created_date=t2.created_date and t1.created_time = t2.created_time and t1.employee_number=t2.employee_number
Where t1.ID<t2.ID
Next, change SELECT * to SELECT t1.ID to get the ID values of the duplicates only, then do a delete query with a subquery:
DELETE
FROM fingerprint
WHERE fingerprint.ID IN
(
SELECT t1.ID
FROM ... (see query above)
)
|
|
|
|
|
Hi,
I'm facing a real challenge in a report I've built with MDX in SSRS.
I have "Keywords" (Dim) column, and "Cost" (Measure) column.
There are a lot of the same keywords (each from different Campaign, which name I preset in the KW tool tip).
I need to make sure that all KWs from the same kind will display one after the other.
The problem is, I need to make sure it's stays in that order even when sorting (interactively) the "Cost" column. basically, the sorting will start again after each group of keywords. And I must display each one of the KWs, not grouping them to 1.
Is it possible? what is the best solution?
Thanks!
|
|
|
|
|
Hi,
There is column for mobile number in my table whose data type is string.
I have to replace six character from middle with star(*) from the string of 10 characters.
For example
The Contact number is 9334459875
I have to display it as follows
93******75 first two characters and last two characters only.
|
|
|
|
|
SELECT LEFT(PhoneNumber, 2) + '******' + RIGHT(PhoneNumber, 2)
FROM AdventureWorks.Person.PersonPhone
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If SQL Server:
PRINT STUFF( '9334459875' , 3 , 6 , '******' )
|
|
|
|
|
SELECT STUFF('9334459875',3,6,'******')
|
|
|
|
|
|
You change the "order by" clause in the SQL statement.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
I am developing a project ASSET MANAGEMENT SYSTEM in which i am giving the asset Id to every asset . I have my office at different places in INDIA. Every now and then new asset is purchased so I want a perfect record in a database.
My question is that i want a asset number consists of company name then 3 words of city and then number .
for eg: let company name is XYZ it is purchased in city MUMBAI so i want asset id like----> XYZ/MUM/001. on every new entry of a record.
AMRITESH ASTHANA
|
|
|
|
|
You are talking about a real-life identifier. That's not the same as a primary key in a database. A primary key does NEVER, EVER have a constant text in there.
You create a field for you numeric; don't use the PK. Next, add in a FK to the place where it is bought. Then create a calculated field to get the name of the place, and format it as your real-life identifier.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You could have three columns in your table called
company_name of type varchar(5) (or whatever length you desire)
purchase_city of type varchar(5) (or whatever length you desire)
asset_sn of type int
Make these columns unique so you can't add the same number twice. Index name could be ix_asset_number
When you add a new inventory item you first get the last registered row for the company and city.
SELECT LAST(asset_sn) AS AssetNumber FROM assets WHERE company_name = 'XYZ' AND purchase_city = 'MUM';
Then increment the AssetNumber with 1 and insert the new record.
|
|
|
|
|
Thanks George it works
|
|
|
|
|
|
In VS I called master.sys.xp_create_subdir @dir to create a folder on a file server, it is successful, but I called my own sp that includes this built-in sp, it is error out and the message is ';Error executing extended stored procedure: Invalid Parameter';, can anyone tell me what the problem is, how should I fix it? Here is the code
create procedure usp_MyProcedure
as
declare @dir varchar(50)
set @dir = '\\servername\folder\subfolder\'
exec master.sys.xp_create_subdir @dir
go
Thank you for your help in advance
|
|
|
|