Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Need help with subquery.

Author  Topic 

LangeJan
Starting Member

2 Posts

Posted - 2007-07-09 : 08:36:18
Hello,

I've the next query but he answer

"Subqueries are not allowed in this context. Only scalar expressions are allowed. "

INSERT INTO
tbl_Tickets (
vld_Onderwerp,
vld_Omschrijving,
vld_Aangemaakt,
vld_Type,
vld_Apparaat,
vld_Klant,
vld_Gebruiker
)
VALUES (
'Test ',
'hoi',
'7/9/2007 1:41:15 PM',
(
SELECT
fld_id
FROM
tbl_storing_types
WHERE
fld_Naam = 'Storing'
),
'54684 ',
'1',
'1'
)


I searched much fora but i can't find a clear solution.

Who can help me?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-09 : 08:43:02
[code]INSERT INTO tbl_Tickets
(
vld_Onderwerp, vld_Omschrijving, vld_Aangemaakt, vld_Type, vld_Apparaat, vld_Klant, vld_Gebruiker
)
SELECT
'Test ', 'hoi', '7/9/2007 1:41:15 PM', fld_id, '54684 ', '1', '1'
FROM
tbl_storing_types
WHERE
fld_Naam = 'Storing'
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

LangeJan
Starting Member

2 Posts

Posted - 2007-07-09 : 09:05:11
Thnx a lot,

Now i think i understand the query. Before this i try to use 2 times select but now the query worked.

Sorry for my bad english but i'm a dutch people. Hope you understand me.
Go to Top of Page
   

- Advertisement -