| Author |
Topic |
|
ferrethouse
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-06-07 : 13:42:37
|
| Is there anything bigger than a BIGINT? |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-06-07 : 14:09:09
|
| You can use a decimal type up to 38 digits, which allows almost twice as many digits as a bigint (using decimal(38,0)). |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-06-07 : 14:43:44
|
WHY do you need something bigger than BIGINT? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2010-06-07 : 14:57:18
|
Must be doing taxes http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
ferrethouse
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-06-07 : 17:14:43
|
quote: Originally posted by Peso WHY do you need something bigger than BIGINT? N 56°04'39.26"E 12°55'05.63"
This statement is dying because the table in question has 68 fields. Anything greater than 63 for "colorder" causes the problem...SELECT @Columns_Updated = ISNULL(@Columns_Updated + ', ', '') + name FROM syscolumns WHERE id = @idTable AND CONVERT(VARBINARY,REVERSE(COLUMNS_UPDATED())) & POWER(CONVERT(BIGINT, 2), colorder - 1) > 0 |
 |
|
|
ferrethouse
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-06-07 : 17:17:00
|
quote: Originally posted by robvolk You can use a decimal type up to 38 digits, which allows almost twice as many digits as a bigint (using decimal(38,0)).
Sadly this results in this error...The data types varbinary and decimal are incompatible in the boolean AND operator |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-06-07 : 18:27:08
|
| Do you find COLUMNS_UPDATED() useful?Because it is the columns included in the SET statement, in the UPDATE statement, rather than columns that have ACTUALLY changed I think its use is rather limited. (Yes you can exclude logic where the columns were definitely not included in the Update statement ... but if you then need to check for which columns actually changed then it becomes a bit immaterial in many scenarios) |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
|
|
ferrethouse
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-06-07 : 19:05:32
|
I found different SQL that seems to work better. One thing I would like to add to the XML that is constructed in this SQL is the old value and the new value. Anyone know how to go about that?DECLARE @FldsUpdated XMLDECLARE @ColumnsUpdated VARBINARY(100)SET @ColumnsUpdated = COLUMNS_UPDATED()print @ColumnsUpdatedSET @FldsUpdated = (SELECT COLUMN_NAME AS NameFROM INFORMATION_SCHEMA.COLUMNS FieldWHERE TABLE_NAME = 'Courses' ANDsys.fn_IsBitSetInBitmask(@ColumnsUpdated, COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), COLUMN_NAME, 'ColumnID')) <> 0 FOR XML AUTO, ROOT('Fields'))INSERT INTO AuditLog(TableName,PrimaryKeyID,ChangedFields)SELECT 'Courses', Inserted.CourseID, @FldsUpdatedFROM INSERTED |
 |
|
|
|