Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SQLERROR
CREATE TABLE [dbo].[Table1]( [id] uniqueidentifier NOT NULL , [id2] uniqueidentifier NOT NULL, [name] nvarchar(max) NOT NULL CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTERED ( [id] ASC )) GO CREATE NONCLUSTERED INDEX [IX_Table2_ID2] ON [dbo].[Table1] ( [id2] ASC ) ALTER TABLE [dbo].[Table1] ADD CONSTRAINT [DF_Id] DEFAULT (newsequentialid()) FOR [id] GO CREATE TABLE [dbo].[Table2]( [id] uniqueidentifier NOT NULL, [name] varchar(10) CONSTRAINT [PK_Table2] PRIMARY KEY CLUSTERED ( [id] ASC )) GO ALTER TABLE [dbo].[Table2] ADD CONSTRAINT [DF_Id2] DEFAULT (newsequentialid()) FOR [id] Declare @loop int = 1 while @loop<=10 begin insert into Table2 ([name]) Values(char((rand()*25 + 65))+char((rand()*25 + 65))+char((rand()*25 + 65))+char((rand()*25 + 65))) set @loop = @loop+1 end set @loop = 1 while @loop<2000 begin insert into Table1 (ID2, [name]) select ID,char((rand()*25 + 65))+char((rand()*25 + 65))+char((rand()*25 + 65))+char((rand()*25 + 65)) from Table2 set @loop = @loop+1 end select top 100 table1.Name,table2.Name from table1 WITH (NOLOCK) left join table2 on table1.ID2= table2.ID order by table2.ID desc,table1.ID desc
run
|
edit
|
history
|
help
0
test44
SQL for beginners( defined with errors while enforcing constraints)
sql jueves
ElaineBrown**
Elena-Tests
Campeonato2DLuizFelipe
SQL Server - UK Holiday Calendar Example
2 лаба
FERNANDA_BD_Registro_De_Estudiantes
n sei o nome (30.10)