Click here to Skip to main content
15,885,914 members
Home / Discussions / Database
   

Database

 
GeneralRe: Writing A Database As Back-End For Application Developed By Others Pin
phil241521-Aug-14 5:20
phil241521-Aug-14 5:20 
Question(Expiring Next Month) Problem Pin
Jassim Rahma11-Aug-14 21:45
Jassim Rahma11-Aug-14 21:45 
AnswerRe: (Expiring Next Month) Problem Pin
Kornfeld Eliyahu Peter11-Aug-14 21:58
professionalKornfeld Eliyahu Peter11-Aug-14 21:58 
GeneralRe: (Expiring Next Month) Problem Pin
Jassim Rahma11-Aug-14 23:40
Jassim Rahma11-Aug-14 23:40 
GeneralRe: (Expiring Next Month) Problem Pin
GuyThiebaut12-Aug-14 1:42
professionalGuyThiebaut12-Aug-14 1:42 
GeneralRe: (Expiring Next Month) Problem Pin
Bernhard Hiller12-Aug-14 21:28
Bernhard Hiller12-Aug-14 21:28 
GeneralRe: (Expiring Next Month) Problem Pin
GuyThiebaut12-Aug-14 21:45
professionalGuyThiebaut12-Aug-14 21:45 
AnswerRe: (Expiring Next Month) Problem Pin
GuyThiebaut11-Aug-14 22:07
professionalGuyThiebaut11-Aug-14 22:07 
QuestionT-Sql Distribute data into groups based on existing numbers Pin
dreaddan10111-Aug-14 10:42
dreaddan10111-Aug-14 10:42 
AnswerRe: T-Sql Distribute data into groups based on existing numbers Pin
Jörgen Andersson13-Aug-14 22:44
professionalJörgen Andersson13-Aug-14 22:44 
QuestionProblem with Decimal Places and Rounding off Pin
Vimalsoft(Pty) Ltd9-Aug-14 23:02
professionalVimalsoft(Pty) Ltd9-Aug-14 23:02 
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 
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 
I went for the later in this function, but found out later that I could of just declared and set all the card data first
and then run the UPDATE using the variables.

So I ended up with this, I shortened it to keep it more brief
UPDATE " & _
OrderInfo " & _
SET
  CardID=@CardID
, Cardlabel=(SELECT Label FROM CardInfoPerm WHERE CardID=@CardID)
, CardBrand=(SELECT CardBrand FROM CardInfoPerm WHERE CardID=@CardID)
, CardExpMonth=(SELECT CardExpMonth FROM CardInfoPerm WHERE CardID=@CardID)
, CardExpYear=(SELECT CardExpYear FROM CardInfoPerm WHERE CardID=@CardID)
WHERE OrderNum=@OrderNum"


But later the next day I ended up writing something that does everything in one shot, far beyond I could imagine that I can do. So I modified the above to this below

DECLARE " & _
@CardLabel VarChar(80)
, @CardBrand VarChar(80)
, @CardExpMonth VarChar(80)
, @CardExpYear VarChar(80)
, @New_OrderNumber VarChar(80);

SET @CardLabel = (SELECT Label FROM CardInfoPerm WHERE CardID=@CardID);
SET @CardBrand = (SELECT CardBrand FROM CardInfoPerm WHERE CardID=@CardID);
SET @CardExpMonth = (SELECT CardExpMonth FROM CardInfoPerm WHERE CardID=@CardID);
SET @CardExpYear = (SELECT CardExpYear FROM CardInfoPerm WHERE CardID=@CardID);

IF EXISTS(SELECT * FROM OrderInfo WHERE OrderNum=@OrderNum)
 BEGIN
  UPDATE
 END
ELSE
 BEGIN
  INSERT
 END

Then, I was able to do more,
delete previous cart items,
generate a new order number,
copy the cart contents over
return the new order number
all in one shot now, use to take me like 8 functions to do it all. I'm amazed at how fast it runs now.

I would post it, but it's too large

I'm stoked on how it came out, and learned a lot on my own. I think I got the semi-colons right this time, I need to read up on that.
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 

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.