checksum,配置在程序返回空。而且還當我嘗試只執行查詢..我得到ABS和在TSQL
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'Audit C recorded' to data type tinyint.
..你可以幫我這個
SELECT CAST(ABS(CHECKSUM(Indicator)) % 450 AS TINYINT) AS Indicator,
CAST(CIndicator AS VARCHAR(100)) AS CIndicator,
CAST(SK_IndicatorL2 AS TINYINT) AS SK_IndicatorL2,
CAST(ABS(CHECKSUM(IndicatorL2)) % 450 AS TINYINT) AS IndicatorL2
FROM (VALUES ('Alcohol',
'Alcohol',
'Audit C recorded',
'Audit C recorded (excluding screen in 3y prior to start of quarter)'),
('Alcohol',
'Alcohol',
'Community Detox and TH CAT',
'Community Detox and TH CAT'),
('Alcohol',
'Alcohol',
'Follow Up appointment',
'Follow Up appointment'),
('Healthy Lifestyles',
'Healthy Lifestyles',
'HealthyLifestyle-Aged 19-39',
'HealthyLifestyle-Aged 19-39'),
('Healthy Lifestyles',
'Healthy Lifestyles',
'Aged 19-39 - BMI recorded',
'Aged 19-39 - BMI recorded')) AS Nis (Indicator,
CIndicator,
SK_IndicatorL2,
IndicatorL2)
我試着這樣做: SELECT CAST(ABS(校驗和(」審計C記錄'))%250作爲TinyInt) 我得到一個適當的整數值。
我得到'當轉換varchar值'Audit C recording'轉換爲數據類型tinyint時轉換失敗。'ANSI_WARNINGS'關閉了嗎?你爲什麼試圖將明顯的非數字數據轉換爲'tinyint'呢? –
我想獲得基於字符的唯一ID ... – user2919277