Click here to Skip to main content
16,014,860 members
Home / Discussions / Database
   

Database

 
GeneralRe: Syntax I Can't Understand Pin
Richard Andrew x646-Jun-07 19:36
professionalRichard Andrew x646-Jun-07 19:36 
QuestionUnique Long ID's in SQL Server 2005 Pin
Mike L.6-Jun-07 14:14
Mike L.6-Jun-07 14:14 
AnswerRe: Unique Long ID's in SQL Server 2005 Pin
Mike Dimmick6-Jun-07 14:49
Mike Dimmick6-Jun-07 14:49 
GeneralRe: Unique Long ID's in SQL Server 2005 Pin
Mike L.6-Jun-07 15:55
Mike L.6-Jun-07 15:55 
QuestionUpdating a record with DBTIMESTAMP in C++ Pin
Mark Kunkel6-Jun-07 9:48
Mark Kunkel6-Jun-07 9:48 
AnswerRe: Updating a record with DBTIMESTAMP in C++ Pin
Mike Dimmick6-Jun-07 11:45
Mike Dimmick6-Jun-07 11:45 
QuestionMust declare the scalar variable "@date"???? Pin
gritter6-Jun-07 8:31
gritter6-Jun-07 8:31 
AnswerRe: Must declare the scalar variable "@date"???? Pin
andyharman6-Jun-07 8:51
professionalandyharman6-Jun-07 8:51 
Try:
CREATE PROCEDURE dbo.sp_GetDowntime 
  @date SMALLDATETIME,
  @dept NVARCHAR(3), 
  @equip NVARCHAR(25),
  @shift NCHAR(1) 
AS BEGIN
  SET NOCOUNT ON

  SELECT h.oee_date, h.dept, h.equip, h.oee_shift, d.dt_reason,
        r.name, d.min
    FROM userdata_header h 
    INNER JOIN userdata_downtime d
      ON h.dept = d.dept
      AND h.oee_date = d.oee_date
      AND h.equip = d.equip
      AND h.oee_shift = d.oee_shift 
    INNER JOIN refer_dt r
      ON d.dt_reason = r.dt_reasonID
    WHERE h.oee_date = @date
    AND h.dept = @dept
    AND h.equip = @equip
    AND h.shift = @shift

  RETURN (0)
END
I found the following problems:
  • The parameters needed commas between them.
  • There was a comma in the where-clause.
  • The "equip" link between the two tables specified the table-names instead of the table aliases.
  • I added "Set Nocount On" because many front-end programming languages by SQL-Server results otherwise.
Regards
Andy
GeneralRe: Must declare the scalar variable "@date"???? Pin
gritter6-Jun-07 9:25
gritter6-Jun-07 9:25 
QuestionHow to move existing controls to access form groupbox? Pin
Dan Neely6-Jun-07 5:44
Dan Neely6-Jun-07 5:44 
AnswerRe: How to move existing controls to access form groupbox? Pin
Giorgi Dalakishvili6-Jun-07 5:54
mentorGiorgi Dalakishvili6-Jun-07 5:54 
GeneralRe: How to move existing controls to access form groupbox? Pin
Dan Neely6-Jun-07 7:18
Dan Neely6-Jun-07 7:18 
AnswerRe: How to move existing controls to access form groupbox? Pin
Mike Dimmick6-Jun-07 11:47
Mike Dimmick6-Jun-07 11:47 
Questionhow to know the datatype of a field in a database? Pin
kalaveer6-Jun-07 2:15
kalaveer6-Jun-07 2:15 
AnswerRe: how to know the datatype of a field in a database? Pin
andyharman6-Jun-07 2:53
professionalandyharman6-Jun-07 2:53 
GeneralRe: how to know the datatype of a field in a database? Pin
kalaveer6-Jun-07 3:33
kalaveer6-Jun-07 3:33 
GeneralRe: how to know the datatype of a field in a database? Pin
andyharman6-Jun-07 3:38
professionalandyharman6-Jun-07 3:38 
AnswerRe: how to know the datatype of a field in a database? Pin
ScottM16-Jun-07 5:09
ScottM16-Jun-07 5:09 
Questiondate functions Pin
rkherath6-Jun-07 0:16
rkherath6-Jun-07 0:16 
AnswerRe: date functions Pin
ganesamoorthidhayalan6-Jun-07 1:05
ganesamoorthidhayalan6-Jun-07 1:05 
GeneralRe: date functions Pin
rkherath6-Jun-07 1:17
rkherath6-Jun-07 1:17 
GeneralRe: date functions Pin
ganesamoorthidhayalan6-Jun-07 1:23
ganesamoorthidhayalan6-Jun-07 1:23 
AnswerRe: date functions Pin
ganesamoorthidhayalan6-Jun-07 1:55
ganesamoorthidhayalan6-Jun-07 1:55 
AnswerRe: date functions Pin
Krish - KP7-Jun-07 22:40
Krish - KP7-Jun-07 22:40 
QuestionHow can I Call batch file (i.e..bat) from Procedure? Pin
Guru_yogi5-Jun-07 23:54
Guru_yogi5-Jun-07 23:54 

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.