我有一个包含楼层名称的表格,我需要用数值替换它。我正在手动构建一个查找表。不知道下一步该怎么做...有更好的方法吗?
截图:http: //i49.tinypic.com/2mc921e.png
BEGIN TRY
BEGIN TRANSACTION
-- lookup table
DECLARE @FloorLkup TABLE(
FloorName VARCHAR(MAX) NOT NULL,
FloorNum INT NOT NULL
);
INSERT INTO @FloorLkup SELECT 'First floor', '1'
INSERT INTO @FloorLkup SELECT 'First', '1'
INSERT INTO @FloorLkup SELECT 'Second floor', '2'
INSERT INTO @FloorLkup SELECT 'Second', '2'
-- etc.
INSERT INTO @FloorLkup SELECT 'Ninth', '9'
print 'Done'
COMMIT TRANSACTION
END TRY
BEGIN CATCH
print 'Did not work'
ROLLBACK
END CATCH
另外,问题是:某些楼层被命名为First
andFirst floor
等。