User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 427,203 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,176 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 494 | Replies: 1
Reply
Join Date: Jul 2005
Posts: 91
Reputation: Jon182 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Jon182 Jon182 is offline Offline
Junior Poster in Training

Query logic

  #1  
Apr 14th, 2008
Hi, sorry for a newbie question but I was wondering if the following is possible:

I have to select some information from a table which I have already created a query for. This information then has to be inserted into a new table but needs another column with another unique custom identifer for each record in the format EX01 which is incremented by 1 for each record. I was wondering how is it possible to do this?

My approach was to create a view and then insert the values form the view into the new table but I still have no idea how to do the unique identifer. Was the first part of my approach correct or have been wrong from the start?

Thanks.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Posts: 21
Reputation: huangzhi is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
huangzhi huangzhi is offline Offline
Newbie Poster

Re: Query logic

  #2  
Apr 14th, 2008
I think you can create identity columns.

create table #tmpTemp 
  (ID int identity(1,1),
   Code varchar(255),
   Name varchar(255))

insert #tmpTemp (Code, Name)
  select 'A', 'AA'		--> replace with your view
  union all
  select 'B', 'BB'

select * from #tmpTemp

drop table #tmpTemp
Hence Wijaya
www.ex-Soft.tk
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 10:49 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC