Click here to Skip to main content
15,900,258 members
Home / Discussions / Database
   

Database

 
AnswerRe: Problem with Decimal Places and Rounding off Pin
Kornfeld Eliyahu Peter10-Aug-14 0:00
professionalKornfeld Eliyahu Peter10-Aug-14 0:00 
GeneralRe: Problem with Decimal Places and Rounding off Pin
Vimalsoft(Pty) Ltd10-Aug-14 1:28
professionalVimalsoft(Pty) Ltd10-Aug-14 1:28 
QuestionSelect and Update Pin
jkirkerx8-Aug-14 11:43
professionaljkirkerx8-Aug-14 11:43 
I'm trying to consolidate 3 operations into 1
Not sure if it's possible, but it's seems like it is.

I want to select some data, and take the data from 1 table and update it to another table.

Her's what I have. It's kind of a soup at the moment, experienenting with different ideas.
In my Create Table, I can't figure out how to use those value in the update in place of the parameters.
Perhaps I should just use the line in Update, the select for CardLabel.

DECLARE @CardID INT;
SET @CardID = 645;
CREATE TABLE #CCInfo
(
   Label VarChar(40) 
 , CardBrand VarChar(80) 
 , CardExpMonth VarChar(80)
 , CardExpYear VarChar(80)
 , CardHolder_FirstName VarChar(80)
 , CardHolder_LastName VarChar(80)
 , CardNum VarChar(80)
 , CardPhoneNum VarChar(20)
)
 INSERT INTO #CCInfo
 (
   Label
 , CardBrand
 , CardExpMonth
 , CardExpYear
 , CardHolder_FirstName
 , CardHolder_LastName
 , CardNum
 , CardPhoneNum
 )
 SELECT 
  Label 
, CardBrand 
, CardExpMonth 
, CardExpYear 
, CardHolder_FirstName 
, CardHolder_LastName 
, CardNum 
, CardPhoneNum 
 FROM CardInfoPerm  
 WHERE CardID=@CardID
 UPDATE
  OrderInfo
  SET
    CardID=@CardID
  , Cardlabel= (SELECT Label FROM CardInfoPerm WHERE CardID=@CardID)
  , CardBrand=Card_
  , CardExpMonth=@CardExpMonth
  , CardExpYear=@CardExpYear
  , CardHolder_FirstName=@CardHolder_FirstName
  , CardHolder_LastName=@CardHolder_LastName
  , CardNum=@CardNum
  , CardPhoneNum=@CardPhoneNum
  , PaymentInfo=@CardID
  , ApprovalCode=''
  , AuthorizationID=''
  , CheckID=''
  , CheckLabel=''
  , CheckType=''
  , CheckName=''
  , BankName=''
  , CheckRoutingNum=''
  , CheckAccountNum=''
  WHERE OrderNum='CA-2054'

AnswerMy none soup version Pin
jkirkerx8-Aug-14 12:11
professionaljkirkerx8-Aug-14 12:11 
AnswerRe: Select and Update Pin
PIEBALDconsult8-Aug-14 20:57
mvePIEBALDconsult8-Aug-14 20:57 
Answer[Solved] Pin
jkirkerx10-Aug-14 12:50
professionaljkirkerx10-Aug-14 12:50 
AnswerRe: Select and Update Pin
MeutherOlaf11-Aug-14 20:36
MeutherOlaf11-Aug-14 20:36 
QuestionWeird problem with UNION query in Access 2010 Pin
Peter R. Fletcher8-Aug-14 3:46
Peter R. Fletcher8-Aug-14 3:46 
QuestionFind the right SSMS Pin
Corporal Agarn8-Aug-14 1:53
professionalCorporal Agarn8-Aug-14 1:53 
AnswerRe: Find the right SSMS Pin
Richard Deeming8-Aug-14 2:18
mveRichard Deeming8-Aug-14 2:18 
GeneralRe: Find the right SSMS Pin
Corporal Agarn8-Aug-14 2:25
professionalCorporal Agarn8-Aug-14 2:25 
Questionsql server insert into select + in select part if else Pin
Karan_TN7-Aug-14 0:16
Karan_TN7-Aug-14 0:16 
AnswerRe: sql server insert into select + in select part if else Pin
Mycroft Holmes7-Aug-14 0:55
professionalMycroft Holmes7-Aug-14 0:55 
QuestionHow to change multiple date formats in Sql server Pin
AzeeM_R6-Aug-14 2:51
professionalAzeeM_R6-Aug-14 2:51 
AnswerRe: How to change multiple date formats in Sql server Pin
Corporal Agarn6-Aug-14 3:38
professionalCorporal Agarn6-Aug-14 3:38 
AnswerRe: How to change multiple date formats in Sql server Pin
Richard Deeming6-Aug-14 3:50
mveRichard Deeming6-Aug-14 3:50 
AnswerRe: How to change multiple date formats in Sql server Pin
Mycroft Holmes6-Aug-14 14:16
professionalMycroft Holmes6-Aug-14 14:16 
SuggestionRe: How to change multiple date formats in Sql server Pin
AzeeM_R11-Aug-14 8:14
professionalAzeeM_R11-Aug-14 8:14 
QuestionHandling Duplicate records Pin
Ambertje5-Aug-14 4:35
Ambertje5-Aug-14 4:35 
Questionsplit datatable column using c# Pin
Jaimin H. Soni4-Aug-14 22:31
Jaimin H. Soni4-Aug-14 22:31 
QuestionRe: split datatable column using c# Pin
Eddy Vluggen5-Aug-14 2:35
professionalEddy Vluggen5-Aug-14 2:35 
AnswerRe: split datatable column using c# Pin
Jaimin H. Soni6-Aug-14 1:12
Jaimin H. Soni6-Aug-14 1:12 
GeneralRe: split datatable column using c# Pin
Eddy Vluggen6-Aug-14 1:56
professionalEddy Vluggen6-Aug-14 1:56 
GeneralRe: split datatable column using c# Pin
Jaimin H. Soni6-Aug-14 2:00
Jaimin H. Soni6-Aug-14 2:00 
GeneralRe: split datatable column using c# Pin
Eddy Vluggen6-Aug-14 2:30
professionalEddy Vluggen6-Aug-14 2:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.