For some reason I'm getting NULL values with the CHOOSE function, but here is one way CREATE TABLE Foo (Col1 VARCHAR(20), Col2 VARCHAR(20), Col3 VARCHAR(20))GOINSERT Foo VALUES(CHOOSE((ABS(CAST(CAST(NEWID() AS VARBINARY) AS INT)) % 3) + 1, 'string1', 'string2', 'string3'),CHOOSE((ABS(CAST(CAST(NEWID() AS VARBINARY) AS INT)) % 3) + 1, 'string1', 'string2', 'string3'),CHOOSE((ABS(CAST(CAST(NEWID() AS VARBINARY) AS INT)) % 3) + 1, 'string1', 'string2', 'string3'))GO 10SELECT *FROM FooDROP TABLE Foo
Also, you could select from a table:CREATE TABLE Val (Col VARCHAR(20));INSERT Val VALUES ('string1'), ('string2'), ('string3');CREATE TABLE Foo (Col1 VARCHAR(20), Col2 VARCHAR(20), Col3 VARCHAR(20));GOINSERT Foo VALUES( (SELECT TOP 1 Col FROM Val ORDER BY NEWID()), (SELECT TOP 1 Col FROM Val ORDER BY NEWID()), (SELECT TOP 1 Col FROM Val ORDER BY NEWID()))GO 10SELECT *FROM FooDROP TABLE FooDROP TABLE Val