Need some access help with SQL query....

Crusty

Lifer
Sep 30, 2001
12,684
2
81
INSERT INTO group_permissions VALUES((SELECT id FROM permissions WHERE ((permissions.permission) = 'edit_lvl1_concerns')),'DnsAdmins');

fails with error

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Reserved error (|); there is no message for this error.

/testing/securityCenter.asp, line 10

The syntax is correct according to Access... and there are no reserved words in the query

Gotta love the nice description of the error message..

any ideas?

edit: When I run that query in Access it gives me error (-3025)... with the same description as above...
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Try:

INSERT INTO group_permissions (id, permissionlevel)
SELECT id,'DnsAdmins' FROM permissions WHERE permissions.permission = 'edit_lvl1_concerns';

I'm just assuming the column names/types in the group permissions table though.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Ummm... I'm not sure about the syntax here:
INSERT
INTO group_permissions
VALUES(
(
SELECT id
FROM permissions
WHERE
(
(permissions.permission) = 'edit_lvl1_concerns'
)
),
'DnsAdmins'
);

Do you want to try doing this:

INSERT
INTO group_permissions
VALUES(
SELECT id, 'DnsAdmins'
FROM permissions
WHERE
(
(permissions.permission) = 'edit_lvl1_concerns'
)
);

 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Originally posted by: Snapster
Try:

INSERT INTO group_permissions (id, permissionlevel)
SELECT id,'DnsAdmins' FROM permissions WHERE permissions.permission = 'edit_lvl1_concerns';

I'm just assuming the column names/types in the group permissions table though.

damm.... beat me to it
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Originally posted by: statik213
Originally posted by: Snapster
Try:

INSERT INTO group_permissions (id, permissionlevel)
SELECT id,'DnsAdmins' FROM permissions WHERE permissions.permission = 'edit_lvl1_concerns';

I'm just assuming the column names/types in the group permissions table though.

damm.... beat me to it

Can't win em all I guess. Least 2 people with the same answer maybe confirms the idea a little better. :)

 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
I get syntax errors with those queries :(

But I did fix it, I just run two seperate queries. What's odd is that the same structure works for a DELETE query.

DELETE group_permissions.* FROM group_permissions WHERE ((group_permissions.id) = (SELECT permissions.id FROM permissions WHERE ((permissions.permission) = 'admin')));
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Originally posted by: MCrusty
I get syntax errors with those queries :(

But I did fix it, I just run two seperate queries. What's odd is that the same structure works for a DELETE query.

DELETE group_permissions.* FROM group_permissions WHERE ((group_permissions.id) = (SELECT permissions.id FROM permissions WHERE ((permissions.permission) = 'admin')));


Strange, I actually created the two tables in question to test when I wrote it and it inserted a few rows fine.