Northwind
instnwnd.sql
—
SQL code,
2065 kB (2115268 bytes)
Conteúdo do arquivo
��/ *
* * C o p y r i g h t M i c r o s o f t , I n c . 1 9 9 4 - 2 0 0 0
* * A l l R i g h t s R e s e r v e d .
* /
S E T N O C O U N T O N
G O
U S E m a s t e r
G O
i f e x i s t s ( s e l e c t * f r o m s y s d a t a b a s e s w h e r e n a m e = ' N o r t h w i n d ' )
d r o p d a t a b a s e N o r t h w i n d
g o
D E C L A R E @ d e v i c e _ d i r e c t o r y N V A R C H A R ( 5 2 0 )
S E L E C T @ d e v i c e _ d i r e c t o r y = S U B S T R I N G ( f i l e n a m e , 1 , C H A R I N D E X ( N ' m a s t e r . m d f ' , L O W E R ( f i l e n a m e ) ) - 1 )
F R O M m a s t e r . d b o . s y s a l t f i l e s W H E R E d b i d = 1 A N D f i l e i d = 1
E X E C U T E ( N ' C R E A T E D A T A B A S E N o r t h w i n d
O N P R I M A R Y ( N A M E = N ' ' N o r t h w i n d ' ' , F I L E N A M E = N ' ' ' + @ d e v i c e _ d i r e c t o r y + N ' n o r t h w n d . m d f ' ' )
L O G O N ( N A M E = N ' ' N o r t h w i n d _ l o g ' ' , F I L E N A M E = N ' ' ' + @ d e v i c e _ d i r e c t o r y + N ' n o r t h w n d . l d f ' ' ) ' )
g o
e x e c s p _ d b o p t i o n ' N o r t h w i n d ' , ' t r u n c . l o g o n c h k p t . ' , ' t r u e '
e x e c s p _ d b o p t i o n ' N o r t h w i n d ' , ' s e l e c t i n t o / b u l k c o p y ' , ' t r u e '
G O
s e t q u o t e d _ i d e n t i f i e r o n
G O
/ * S e t D A T E F O R M A T s o t h a t t h e d a t e s t r i n g s a r e i n t e r p r e t e d c o r r e c t l y r e g a r d l e s s o f
t h e d e f a u l t D A T E F O R M A T o n t h e s e r v e r .
* /
S E T D A T E F O R M A T m d y
G O
u s e " N o r t h w i n d "
g o
i f e x i s t s ( s e l e c t * f r o m s y s o b j e c t s w h e r e i d = o b j e c t _ i d ( ' d b o . E m p l o y e e S a l e s b y C o u n t r y ' ) a n d s y s s t a t &