473,498 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select/Insert/Update a column with out a header

31 New Member
Hey all, i'm trying to add two columns and send them into a column field in another table.

But, i'm getting an error saying that my column doesn't have a header. Any suggestions on how into insert query results that are teh result of computations? TIA
Feb 2 '09 #1
4 6523
ck9663
2,878 Recognized Expert Specialist
Can you post what you have so far?

-- CK
Feb 2 '09 #2
newbtemple
31 New Member
Expand|Select|Wrap|Line Numbers
  1.  select e1.position + e2.position
  2.   Into DP.dbo.CP
  3.   from DP.dbo.excelDp e1, DP.dbo.excelDp e2
  4.   where e1.char1 = e2.char1 and e1.char2 = e2.char2  and e1.account = 'xx5' and e2.account = 'xx3'
  5.  
  6.  
Msg 1038, Level 15, State 5, Line 2
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name.
the code returns a column. The first column is the result of the arithmetic operation but has no column name. I found a solution in my application code but it takes one full iteration through the data. It's not a big deal but I think that this might be a scenario i'll come across again and would like to learn. The SQL algorithms are about a bajagaziillion times faster than what I code.
Feb 2 '09 #3
ck9663
2,878 Recognized Expert Specialist
A column alias should solve your problem. Something like.


Expand|Select|Wrap|Line Numbers
  1. select e1.position + e2.position as NewColumnName
  2. Into DP.dbo.CP
  3. from DP.dbo.excelDp e1, DP.dbo.excelDp e2  where e1.char1 = e2.char1 and e1.char2 = e2.char2  and e1.account = 'xx5' and e2.account = 'xx3'
  4.  
Happy Coding!


-- CK
Feb 2 '09 #4
newbtemple
31 New Member
Brilliant. Thanks for the help!
Feb 3 '09 #5

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

Similar topics

16
16972
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
6
4734
by: Nate Jones via DBMonster.com | last post by:
I hope this isn't to simple of a question, but google/deja/DB2 doc have not given me an answer yet. In Oracle, we have the ability to grant select to all tables at the user level. In DB2,...
4
11269
by: Nick Barr | last post by:
Hi, I am trying to gather stats about how many times a resource in our web app is viewed, i.e. just a COUNT. There are potentially millions of resources within the system. I thought of two...
3
10854
by: taru | last post by:
Env: DB2 UDB 8.1 on AIX We are executing a db2 sql stored procedure which is invoked from a java client. The stored procedure contains few select, insert and update statements. Using the DB2...
3
2835
by: Bob Bedford | last post by:
hello I'm looking for some functions or objects allowing to select-insert-update-delete from any table in a mysql database without the need to create a new query every time. Example: ...
2
16023
by: fatjoez | last post by:
Hi there. I'm trying to create a Trigger for on insert, which will be triggered upon any attempted insert into a database table item. Basically want it to say, if the attempted insert value for...
2
7695
by: mokazawa1 | last post by:
Hi, I'm using stored procedures in DB2 UDB 8.1.2. In this stored, I execute a select for update command, opening a cursor. Then I update the rows using fetch and current of. The problem is that...
0
2687
by: kumardharanik | last post by:
Hi Friends, The below code is a sample code for insert, update and delete using datagrid but i need to convert the entire code for datagridview.. Plsss help me.. using System; using...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.