Delete From From - Precisazione

Posto qualche precisazione (prima che qualcuno si spazzoli il database!!!)

Nel mio vecchio post spiegavo come risolvere un problema della cancellazione via TSQL tramite l'utilizzo della Delete From From.

Tutto ok, ci tengo solo a precisare che la sintassi da utilizzare nella clausola di Where della seconda From, infatti questa deve essere una join, ad esempio:

Delete 
From TabellaA 
From TabellaA A join TabellaB B on A.Kiave = B.Kiave

La cancellazione non funziona correttamente se si spefica un'istruzione del tipo:

Delete 
From TabellaA 
From (Select A.* From TabellaA , TabellaB B Where A.Kiave = B.Kiave) X

o del tipo:

Delete 
From TabellaA 
From Vista

anche se "Vista" viene creata così:

CREATE VIEW dbo.Vista
AS
SELECT A.Kiave, A.Descrizione FROM TabellaA AS A JOIN dbo.TabellaB AS B ON A.Kiave = B.Kiave

In entrambe gli ultimi due casi scrivo che la cancellazione non funziona correttamente in quanto andrebbe ad interessare tutti i record della tabella TabellaA e non solo quelli interessati dalla join con TabellaB.

 

Riccardo.

posted @ martedì 15 luglio 2008 14:52

Print

Comments on this entry:

# john

Left by flowers of kenya at 11/04/2011 16:35
Gravatar
I always visit your blog everyday to read new topics

# re: Delete From From - Precisazione

Left by Furiosa at 24/02/2016 19:42
Gravatar
This one helped me for a theory which I am composing. Much thanks to you for giving me another perspective on this troublesome circumstance. Presently I can undoubtedly finish my article. Much appreciated.
Hikvision UK

# re: Delete From From - Precisazione

Left by Furiosa at 24/02/2016 22:51
Gravatar
I have been looking for data on this point for as far back as couple of hours and observed your post to be elegantly composed and have strong data.
Hikvision CCTV Kit

# re: Delete From From - Precisazione

Left by Furiosa at 24/02/2016 22:52
Gravatar
At last I got a site from where I know how to actually take important data concerning my study and learning.
Hikvision NVR

# re: Delete From From - Precisazione

Left by Furiosa at 24/02/2016 22:52
Gravatar
Best work you have done, this online site is truly cool with awesome facts.
Hikvision DVR

# re: Delete From From - Precisazione

Left by Furiosa at 24/02/2016 22:53
Gravatar
Design of data your shared is pretty simple and a decent easy to understand interface.
Hikvision Turbo HD DVR

# re: Delete From From - Precisazione

Left by Furiosa at 24/02/2016 22:54
Gravatar
I think the administrator of this site is really working hard in favor of his site, on the grounds that here each stuffs is quality based information.
Hikvision Camera
Comments have been closed on this topic.
«novembre»
domlunmarmergiovensab
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567