如何将现有列从bit
更改为外键(int
)?
例如,列NEW_B
的创建方式如下:
ALTER TABLE [dbo].[APPLICATION]
ADD [NEW_B] [bit] NULL
GO
但现在我希望NEW_B
引用表ID
的列ATTACHMENT
(int)(希望保留名称NEW_B
,同时允许NULLs
)。
答案 0 :(得分:2)
以下是语法:
{-# LANGUAGE OverloadedStrings #-}
module Bar where
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Control.Applicative
import Control.Monad.Trans.Except
import Data.Monoid
check1 str =
if str == "abc"
then return 1
else throwE ["not equal to abc" ]
check2 str =
if str == "def"
then return 2
else throwE ["not equal to def" ]
checks str = check1 str <|> check2 str <|> throwE ["not abc or def"]
main :: IO ()
main = do
input <- BS.getLine
case runExcept $ checks input of
Left e -> mapM_ (BS.putStrLn . ("Error: " <>)) e
Right a -> print a