Click here to Skip to main content
15,880,392 members
Home / Discussions / Database
   

Database

 
GeneralRe: How to insert data from MS SQL server in MS EXCEL Sheet? Pin
guriqbal8720-Jul-08 20:50
guriqbal8720-Jul-08 20:50 
AnswerCross Post Pin
Paul Conrad17-Jul-08 16:51
professionalPaul Conrad17-Jul-08 16:51 
QuestionSending Email Pin
jonhbt17-Jul-08 3:38
jonhbt17-Jul-08 3:38 
AnswerRe: Sending Email Pin
Wendelius17-Jul-08 8:06
mentorWendelius17-Jul-08 8:06 
QuestionNested Cursor loop problem Pin
Member 387988117-Jul-08 3:25
Member 387988117-Jul-08 3:25 
AnswerRe: Nested Cursor loop problem Pin
Mark J. Miller17-Jul-08 9:27
Mark J. Miller17-Jul-08 9:27 
GeneralRe: Nested Cursor loop problem [modified] Pin
Member 387988117-Jul-08 19:59
Member 387988117-Jul-08 19:59 
GeneralRe: Nested Cursor loop problem Pin
Mark J. Miller18-Jul-08 5:20
Mark J. Miller18-Jul-08 5:20 
Instead of a cursor, why not try this:

<br />
SELECT <br />
	dbo.tbl_Login.MID,<br />
	convert(varchar(20),TSDate,101) as [Date],<br />
	TSSubject as [Subject],<br />
	TSDescription as [Description],<br />
	TSHour as [Hour],<br />
	TSMin as [Minute],<br />
	convert(varchar(20),CreationDate,101) as [Creation Date],<br />
	CreationBy as [Name Of Employee] <br />
FROM @tbl_TempManagers M<br />
INNER JOIN tbl_login E ON E.Mid = M.ManagerID<br />
INNER JOIN tbl_TSEnterData D ON D.CreationBy = E.UserName<br />
WHERE D.TSDate BETWEEN DATEADD(wk, -1, @d) <br />
	AND DATEADD(dd, -1, @d) <br />
order by D.CreationBy asc,D.TSDate Desc<br />


Temp tables are just like regular tables and can be used in all the same ways. You don't need a foreign key reference to join tables - foreign key references are for data integrity, they aren't required at all in the database, but they are certainly needed to prevent data corruption. So based on what I can tell from your script you can use joins on your temp tables.

Also, as a side note - remove the CONVERT function from your where clause - you're using it to format the date values, but the only reason to format those values is if TSDate is a VARCHAR.

Code responsibly: OWASP.org
Mark's blog: developMENTALmadness.blogspot.com

QuestionCompact database not working Pin
krishnan.s17-Jul-08 2:41
krishnan.s17-Jul-08 2:41 
AnswerRe: Compact database not working Pin
Paul Conrad17-Jul-08 16:51
professionalPaul Conrad17-Jul-08 16:51 
QuestionNot In operation? Pin
Member 387988117-Jul-08 1:03
Member 387988117-Jul-08 1:03 
AnswerRe: Not In operation? Pin
TheFM23417-Jul-08 3:00
TheFM23417-Jul-08 3:00 
GeneralRe: Not In operation? Pin
Member 387988117-Jul-08 3:09
Member 387988117-Jul-08 3:09 
Questionselect datas using union operation Pin
deepthy.p.m16-Jul-08 22:48
deepthy.p.m16-Jul-08 22:48 
AnswerRe: select datas using union operation Pin
Vimalsoft(Pty) Ltd17-Jul-08 0:50
professionalVimalsoft(Pty) Ltd17-Jul-08 0:50 
Questionreturn Table name + Column Name in sql query Pin
farabba16-Jul-08 20:51
farabba16-Jul-08 20:51 
AnswerRe: return Table name + Column Name in sql query Pin
Harvey Saayman16-Jul-08 23:01
Harvey Saayman16-Jul-08 23:01 
GeneralRe: return Table name + Column Name in sql query Pin
Mycroft Holmes17-Jul-08 20:08
professionalMycroft Holmes17-Jul-08 20:08 
GeneralRe: return Table name + Column Name in sql query Pin
Harvey Saayman17-Jul-08 20:19
Harvey Saayman17-Jul-08 20:19 
GeneralRe: return Table name + Column Name in sql query Pin
Mycroft Holmes17-Jul-08 20:44
professionalMycroft Holmes17-Jul-08 20:44 
AnswerRe: return Table name + Column Name in sql query Pin
MBCDC21-Jul-08 0:39
MBCDC21-Jul-08 0:39 
Questiondynamically applyin styles based on DB Value to reports Pin
ch.ramesh16-Jul-08 19:06
ch.ramesh16-Jul-08 19:06 
AnswerRe: dynamically applyin styles based on DB Value to reports Pin
Ashfield16-Jul-08 20:13
Ashfield16-Jul-08 20:13 
GeneralRe: dynamically applyin styles based on DB Value to reports Pin
ch.ramesh16-Jul-08 20:21
ch.ramesh16-Jul-08 20:21 
GeneralRe: dynamically applyin styles based on DB Value to reports Pin
Ashfield17-Jul-08 2:24
Ashfield17-Jul-08 2:24 

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.