Viewing 15 posts - 4,936 through 4,950 (of 6,036 total)
1. Your table design is wrong.
It must be:
InvoiceID int,
PaymentDate datetime,
PaymentTypeID smallint,
PaymentAmount money
2. Does not matter. Fix No.1.
_____________
Code for TallyGenerator
October 15, 2006 at 3:04 pm
So, what's a problem?
SELECT SUM(Cash) + SUM(Cheque) + SUM(CC) + SUM(Account) + SUM(Total) + SUM(Gst) + etc
WHERE mydate >= @StartDate and mydate < @EndDate+1
_____________
Code for TallyGenerator
October 15, 2006 at 4:17 am
Mark, you're welcome.
Hope, you don't take all suggestions above as solutions, you take it just like directions.
Because otherwise you are in trouble. ![]()
_____________
Code for TallyGenerator
October 14, 2006 at 9:29 pm
Jeff, are you sure 26 seconds is good enough?
Especially comparing to under 1 second from computed column?
Not everyone is that lucky to have 26 seconds to wait.
I have requirement...
_____________
Code for TallyGenerator
October 13, 2006 at 10:44 pm
October 13, 2006 at 5:28 pm
I see a join from sysindexes to sysobjects: si.id = OBJECT_ID(so.name)
BTW, quite, mmm..., not reasonable. It must be just si.id = so.id.
But where is your join to...
_____________
Code for TallyGenerator
October 13, 2006 at 5:20 pm
What are you trying to save?
Database space or form space?
Empty value in nvarchar cell takes 3 bytes. Every charachter adds 2 bytes.
So, value '1,2' will take 9 bytes, smallint 1...
_____________
Code for TallyGenerator
October 13, 2006 at 4:36 pm
1) What for?
2) If there is no database name what will tell you which database this particular table belongs to?
_____________
Code for TallyGenerator
October 13, 2006 at 4:20 pm
Help for what?
CREATE TABLE [citrixlog] (
[TimeGenerated] [datetime] NULL ,
GeneratedOnHour AS (dateadd(hh, DATEPART(hh, TimeGenerated), dateadd(dd, datediff(dd, 0, TimeGenerated), 0) ) ) ,
[SessionID] [int] NULL ,
[ClientName] [varchar] (255)...
_____________
Code for TallyGenerator
October 13, 2006 at 4:11 pm
As I understand your ID is not unique.
So how SQL Server must know which of ID's in primary table the ID in FK table is referencing?
In other words: can...
_____________
Code for TallyGenerator
October 13, 2006 at 4:04 pm
1) Why all those Generated... columns are varchar(255) ?
Just in case?
Tinyint would be absolutely enough. Except for Year, where smallint would be required
2) drop all those useless columns.
3) Create 1...
_____________
Code for TallyGenerator
October 13, 2006 at 2:11 am
Add computed colmn:
= dateadd(hh, DATEPART(hh, Entrytime), dateadd(dd, datediff(dd, 0, Entrytime), 0) ) AS HourStart
and create index on it.
After that you may group by that column.
_____________
Code for TallyGenerator
October 12, 2006 at 5:46 pm
You must use
exec sp_executesql @sqlstmt, N'@cnt int OUTPUT', @cnt = @cnt OUTPUT
PRINT @cnt
_____________
Code for TallyGenerator
October 12, 2006 at 12:15 am
Was it
select * into #temp from basis
or
SET @sql = 'select * into #temp from basis'
EXEC (@SQL)
?
_____________
Code for TallyGenerator
October 11, 2006 at 11:18 pm
You did not asked the question.
Point is: #Tables are limited to the scope.
If you created and/or populated #Table in another dynamic statement then this table was dropped as soon as...
_____________
Code for TallyGenerator
October 11, 2006 at 11:00 pm
Viewing 15 posts - 4,936 through 4,950 (of 6,036 total)