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 2000 Forums
 Transact-SQL (2000)
 Fixed value while importing from other table

Author  Topic 

jabedin
Starting Member

28 Posts

Posted - 2004-04-15 : 20:02:29
Hi there,

When I am importing data from a table,I need to add a fixed value in one into one column(X). How do I manage this.

Example:

INSERT INTO dbo.Table1
(F1, F2,
X)

SELECT F1, F2
FROM Table2)
go

How can I supply the value of X. Currently, I am updating the value of X after getting the data from table2. Is there a way where I can use both Select and value clause.

I would appreciate your help regarding this



Jay
Bella Vista
NSW-2153

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-04-15 : 20:04:08
Yes, just put the literal (fixed) value into the SELECT statement...

INSERT INTO dbo.Table1 (F1, F2, X)
SELECT F1, F2, 'My Literal text' FROM Table2

--------------------------------------------------------------
Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url]
Go to Top of Page

jabedin
Starting Member

28 Posts

Posted - 2004-04-15 : 20:35:55
Thank you very much mate. That is great.

Regards

Jay
Bella Vista
NSW-2153
Go to Top of Page
   

- Advertisement -