473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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

I am writing this query but didnt understand why isnt it working...
Its giving me the error :
Subqueries are not allowed in this context. Only scalar expressions are allowed.
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO [Job] ([User_Id], [Cat_id], [Job_Description], [Job_Status], [JobTitle], [NumberOfPositions], [JobTenure], [ManagementLevel], [JobDuration], [EducationRequired], [Experience], [RequiredTravel], [Salary], [StartDate], [CoverLetterRequirement], [ContactPerson], [EmailAddress], [Closing Date CV], [EmployerName], [EmployerPersonalEmail], [EmployerPhone])
  2. VALUES ((select ([Job].User_Id) as UserID from Job
  3. inner join Users ON ([Job].User_Id = [Users].User_Id)
  4. where [Job].User_Id = '1') , @Cat_id, @Job_Description, @Job_Status, @JobTitle, @NumberOfPositions, @JobTenure, @ManagementLevel, @JobDuration, @EducationRequired, @Experience, @RequiredTravel, @Salary, @StartDate, @CoverLetterRequirement, @ContactPerson, @EmailAddress, @Closing_Date_CV, @EmployerName, @EmployerPersonalEmail, @EmployerPhone)
  5.  
Jan 12 '10 #1
3 6017
ck9663
2,878 Expert 2GB
I assume your SELECT will only return a single record. Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. INSERT INTO [Job] ([User_Id], [Cat_id], [Job_Description], [Job_Status], [JobTitle], [NumberOfPositions], [JobTenure], [ManagementLevel], [JobDuration], [EducationRequired], [Experience], [RequiredTravel], [Salary], [StartDate], [CoverLetterRequirement], [ContactPerson], [EmailAddress], [Closing Date CV], [EmployerName], [EmployerPersonalEmail], [EmployerPhone])
  4. select ([Job].User_Id) as UserID, @Cat_id, @Job_Description, @Job_Status, @JobTitle, @NumberOfPositions, @JobTenure, @ManagementLevel, @JobDuration, @EducationRequired, @Experience, @RequiredTravel, @Salary, @StartDate, @CoverLetterRequirement, @ContactPerson, @EmailAddress, @Closing_Date_CV, @EmployerName, @EmployerPersonalEmail, @EmployerPhone 
  5. from Job inner join Users ON ([Job].User_Id = [Users].User_Id)
  6. where [Job].User_Id = '1'
  7.  
  8.  
Happy Coding!!!

~~ CK
Jan 12 '10 #2
Hi CK

Sorry my information mislead you ... My mistake... Sorry for that..

I have two tables one is the "HOST" through which I am going to get the userID and the other is the "JobCategory" from which I am going to get a job_CategoryID... And the rest of the values are going to come from the aspx form.
I want to insert all the values from the form except the hosts User_ID and Job Category cateogryID, so that I could insert it directly.
The table I am using to insert the information is the JOB table..

Can you please help me with that...

Thanks in advance

Regards,

Syed Ahmed Hussain
Jan 15 '10 #3
ck9663
2,878 Expert 2GB
Could you post the structure of your tables or sample data and identify which data would be coming from where?

Happy Coding!!!

~~ CK
Jan 20 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: roger | last post by:
I'm having difficulties invoking a user defined table function, when passing to it a parameter that is the result of another user defined function. My functions are defined like so: drop...
0
by: falcon | last post by:
Sorry. I was wrong about "global" statement. Then examples seems to be even more intricate: def Synhronised(lock,func): lock.acquire() try: func() finally: lock.release() .....
14
by: Clay_Culver | last post by:
My professor claims that this code: int f() { int x = 5; int &y = x; x += ++y; return x; }
2
by: Robert Stearns | last post by:
I obviously dave the following specified incorrectly. There is only one entity_id with 33.34 as the percent value for each bhid, as you can see from the attached data. I expected the use of t1.bhid...
1
by: Endif | last post by:
I am tring to execute the following SQL statements through the Iseries Navigator for DB2/V8.2, But i come up with an error saying recursion is not allowed in common table expression. This is a...
2
by: Kivak | last post by:
Hi, I am having a SQL Server 2005 problem with my Insert statement. I am sending a command via my website to my database. It comes up with an error I'll put below. The code is here: "INSERT...
1
by: Khai Doan | last post by:
Perl has a concept of list / scalar context. Is there such a list context in javascript ? Thanks Khai
41
by: dspfun | last post by:
Hi! Are suffixes allowed on expressions? For example, is the following allowed: #define SECONDS_PER_YEAR (60 * 60 * 365) UL I found this in a C test at...
2
by: gen3exo | last post by:
I have a query which contains AND E.escalation_ID IN (CASE WHEN ISNULL(@template,0) =0 THEN (E.Escalation_ID) ELSE (SELECT escalation_ID FROM template_info_TB WHERE field_name LIKE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.