Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > Access versus SQLServer DELETE statements
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 10th April 23:38
russ
External User
 
Posts: 1
Default Access versus SQLServer DELETE statements



I have a working Access SQL statement (below) that is not
working on an SQLServer and I can't work out why


DELETE [table1].*, [table2].* FROM [table1] INNER JOIN
[table2] ON [table1].[table1ID]=[table2].[table2ID] WHERE
(([table1].[table1ID]) = ?)


If anyone could point out to me what i've done wrong,
then I would really appreciate it.

thanks in advance,
Russ
  Reply With Quote


  sponsored links


2 10th April 23:38
i_am_don_and_you?
External User
 
Posts: 1
Default Access versus SQLServer DELETE statements



If you want to delete the records only from table1 then the correct
statement would be:

DELETE table1
FROM table1 INNER JOIN table2
ON [table1].[table1ID]=[table2].[table2ID]
WHERE ([table1].[table1ID] = 'TYPE_HERE')
  Reply With Quote
3 18th April 01:41
vishal parkar
External User
 
Posts: 1
Default Access versus SQLServer DELETE statements


Russ,

Im not sure what does this syntax does. But in SQL Server one DELETE
statement can delete rows from only one table at a time.
The syntax looks like:

/*following query will delete records from titleauthor tables for matching
title_id from titles table where title column value's contains words
'computers' */

USE pubs
DELETE FROM titleauthor
WHERE title_id IN
(SELECT title_id
FROM titles
WHERE title LIKE '%computers%')

/*above same example can be interpreted as follows*/
USE pubs
DELETE titleauthor
FROM titleauthor INNER JOIN titles
ON titleauthor.title_id = titles.title_id
WHERE titles.title LIKE '%computers%'

Note that first example is sql 92 complaint where as 2nd is T-SQL (specific
to SQL Server)

Search in Books online for the topic "DELETE" which has good explaination
and lot of sample examples.

--
-Vishal
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666