How to generate random boolean value in sql server 2008?

Viewed 9441

Im writing a database for some kind of university and there is a table named

Contact_Assign Its parameters are:

Is_Instructor       UD_BOOLEAN NOT NULL,
Is_TeacherAssistant UD_BOOLEAN NOT NULL,
Is_Student          UD_BOOLEAN NOT NULL,
Registration_ID     UD_ID      NOT NULL,
Contact_ID          UD_ID      NOT NULL,

now I want to insert dummy data in this table but I have no idea how can I do this for the boolean parameters.

PS. UD_BOOLEAN is

CREATE TYPE UD_BOOLEAN FROM BIT

any idea how?

4 Answers

Another solution that makes use of NEWID():

select ABS(CHECKSUM(NEWID())) % 2
Related