Diff for "MSSqlWorkBook" UserPreferences
 
Help Info Print View Search Diffs Edit
 À妽º   Ã£±â   Freeboard   Subjectless   Images   ÃÖ±Ù±Û 

Differences between version dated 2004-09-08 11:16:39 and 2004-09-14 16:53:59 (spanning 12 versions)
Deletions are marked like this.
Additions are marked like this.

====== ¿ÀÀü 11:16 2004-09-08 ======

===== ¿ÀÈÄ 1:27 2004-09-14, p.329 =====

Ä¿¼­ÀÇ Á¾·ù - t-sql server cursor, api server cursor, client cursor ;

t-sql ;

 DECLARE testcursor CURSOR FOR

 SELECT * FROM testtb2

 

 OPEN testcursor

 

 FETCH NEXT/PRIOR/FIRST/LAST FROM testcursor

 FETCH RELATIVE 0 FROM testcursor

 FETCH ABSOLUTE 0 FROM testcursor

 

 UPDATE testtb2

 SET test_text ='test'

 WHERE CURRENT OF testcursor

 

 CLOSE testcursor

 

 DEALLOCATE testcursor

 

api - oledb, odbc, db-library (¼­¹öÃø api)

client - odbc, db-library, ado api ³»ºÎ ±¸Çö. forwardonly, static Ä¿¼­¸¸ °¡´É

 

xml Áö¿ø

 SELECT * FROM testtb2 t1 inner join testtb2 t2

 on t1.tempid = t2.tempid

 FOR XML

 RAW AUTO EXPLICIT, (XMLDATA, ELEMENTS, BINARY BASE64)

XMLDATA - schema Ãâ·Â

ELEMENTS - ÇÏÀ§ µ¥ÀÌÅ͸¦ Ư¼ºproperty°¡ ¾Æ´Ñ ¿ä¼Òelement·Î Ãâ·Â, auto¿¡¼­¸¸ °¡´É

BINARY BASE64 - ÀÌÁø µ¥ÀÌÅ͸¦ base64 ÀÎÄÚµùÀ¸·Î Ç¥½Ã

 

openxml

 DECLARE @hdoc INT

 

 EXEC sp_xml_preparedocument @hdoc OUTPUT,

 N'<ROOT>

  <Customers CustomerID="XYZAA" Contactname="Joe" Companyname="Company1">

  <Orders CustomerID="XYZAA" Orderdate="2000-08-25T00:00:00" />

  <Orders CustomerID="XYZAA" Orderdate="2000-08-31T00:00:00" />

  </Customers>

  <Customers CustomerID="XYZAB" Contactname="Steve" Companyname="Company2">

   No orders yet?

  <Orders CustomerID="XYZAB" Orderdate="2000-02-25T00:00:00" />

  <Orders CustomerID="XYZAB" Orderdate="2000-03-31T00:00:00" />

  </Customers>

 </ROOT>'

 

 SELECT * FROM OPENXML(@hdoc, N'/ROOT/Customers/Orders')

 

 WITH ( CustomerID NCHAR(5) './@CustomerID',

 Contactname NVARCHAR(50) '../@Contactname', Orderdate DATETIME)

 

 EXEC sp_xml_removedocument @hdoc

 

sp_rename 'customers.contacttitle', 'title', 'COLUMN' ; Ä÷³ À̸§ º¯°æ

 

ÀúÀå ÇÁ·Î½ÃÀú - ½Ã½ºÅÛ ÀúÀå ÇÁ·Î½ÃÀú, ·ÎÄà ÀúÀå ÇÁ·Î½ÃÀú, Àӽà ÀúÀå ÇÁ·Î½ÃÀú, È®Àå ÀúÀå ÇÁ·Î½ÃÀú, ¿ø°Ý ÀúÀå ÇÁ·Î½ÃÀú

 OBJECTPROPERTY ÇÔ¼ö¸¦ »ç¿ë, isextendedproc ¼Ó¼ºÀ¸·Î È®ÀåspÀÎÁö ½Ã½ºÅÛspÀÎÁö ÆǺ° °¡´É

 

ÇØ´ç °³Ã¼ÀÇ ½ºÅ©¸³Æ® ¿­¶÷

 sp_helptext master.dbo.sp_who

 select text from master.dbo.sp_who s inner join master.dbo.sp_who c on s.id = c.id

 where s.name = 'sp_who'

 

ÇÁ·Î½ÃÀúÀÇ À̸§ ¾Õ¿¡ #¸¦ Ç¥½ÃÇÔÀ¸·Î½á tempdb¿¡ »ý¼ºÇÏ´Â Àӽà ÀúÀå ÇÁ·Î½ÃÀú¸¦ ¸¸µç´Ù.

##ÀÏ °æ¿ì ±Û·Î¹ú Àӽà ÀúÀå ÇÁ·Î½ÃÀú°¡ µÈ´Ù

 

 CREATE PROCEDURE up_temptb

 AS

 SELECT * From testtb2

 

WITH RECOMPILE - ½ÇÇà½Ã¸¶´Ù ÄÄÆÄÀÏÇÑ´Ù.

WITH ENCRYPTION - ½ºÅ©¸³Æ® ³»¿ëÀ» ¾ÏȣȭÇÑ´Ù.

 OBJECTPROPERTY ÇÔ¼öÀÇ isencrypt ¼Ó¼ºÀ¸·Î ¾ÏȣȭµÇ¾ú´ÂÁö ÆǺ° °¡´É

 

autostart ÇÁ·Î½ÃÀú°¡ ÀÚµ¿À¸·Î ½ÃÀ۵ǵµ·Ï ±¸¼º(dbo ¼ÒÀ¯À̸ç master db¿¡ ÀÖ¾î¾ß ÇÔ) ;

 sp_procoption

 @procname = autostart,

 @optioname = startup,

 @optionvalue = true

 OBJECTPROPERTY ÇÔ¼öÀÇ execisstartup ¼Ó¼ºÀ¸·Î ÀÚµ¿ ½ÃÀÛ ÆǺ°

 

sql server°¡ ´ÙÀ½¹ø¿¡ ½ÃÀÛÇÒ ¶§ ÀÚµ¿ ½ÃÀÛ ±¸¼ºÀ» ÇÏÁö ¾Êµµ·Ï ÇÔ ;

 EXECUTE sp_configure

 @configname = 'scan for startup procs', @configvalue = 0

 RECONFIGURE

 GO

 

ALTER PROCEDURE ±¸¹® »ç¿ë½Ã, WITH ¼Ó¼ºÀº À¯ÁöµÇÁö ¾ÊÀ¸¹Ç·Î ´Ù½Ã ¸í½ÃÇØ¾ß ÇÔ.

 

sp_rename @objname = 'up_test', @newname = 'up_testnew', @objtype = 'object' ; sp À̸§ ¼öÁ¤

sp_depends ; ÀÇÁ¸ °ü°è °Ë»ç

 

DROP PROCEDURE¸¦ ½ÇÇàÇϸé ÇöÀç db¿¡¼­ ÇØ´ç sp¸¦ ã°í, ¾øÀ¸¸é master db¸¦ °Ë»öÇÑ´Ù.

 

 

===== ¿ÀÈÄ 12:00 2004-09-13, p.280 =====

where - any/some, all Å°¿öµå

a > any ( select 1 union select 5 union select 30 )

a > all ( select 1 union select 5 union select 30 )

 

anyÀÇ °æ¿ì 1, allÀÇ °æ¿ì 30º¸´Ù Ä¿¾ß ÇÔ.

(any Å°¿öµå´Â In°ú Ư¼ºÀÌ ºñ½Á)

 

order by ~ with rollup : ¿ä¾à Áý°è.

with cubeÀÇ °æ¿ì¿¡´Â A -> B ¹æÇâÀ¸·ÎÀÇ ¿ä¾àÁý°è »Ó¸¸ÀÌ ¾Æ´Ï¶ó B -> A ¹æÇâÀ¸·ÎÀÇ ¿ä¾àÁý°èµµ Áö¿øÇÑ´Ù.

 

ntext, text, image

 ; ado - appendchunk·Î ¼öÁ¤

 ; oledb - ISequentialStream ÀÎÅÍÆäÀ̽º·Î »õ °ªÀ» ¾µ ¼ö ÀÖÀ½

 ; odbc - sqlpudataÀÇ data-at-execution ÆûÀ» »ç¿ë °¡´É

 ; db-library ¾îÇÃÀº dbwritetext ÇÔ¼ö¸¦ »ç¿ë, ¼öÁ¤Àº dbupdatetext ÇÔ¼ö

 ; t-sql - updatetext ±¸¹® »ç¿ë

 

delete, api, cursor, truncate table ; rowsetÀ» »èÁ¦ÇÒ ¼ö ÀÖ´Â ±¸¹®µé

 

delete like this ; DELETE books FROM titles WHERE books.title = titles.title AND titles.royalty = 10

truncate table is not LOGGED!

 

bcp tempdb..testtb out c:\testtb.txt -c -T

bcp tempdb..testtb2 in c:\testtb.txt -c -T

(´ë»ó Å×À̺íÀº ¸¸µé¾îÁ® ÀÖ¾î¾ß ÇÔ)

or

BULK INSERT testtb2

FROM 'c:\testtb.txt'

WITH (DATAFILETYPE = 'char')

 

* bcp´Â Å×ÀÌºí ´ÜÀ§ÀÇ ´ë·® Insertion¿¡ ÀûÇÕ

 

linked server ; sp_addlinkedserver or em¿¡¼­ ¼­¹ö Á¤ÀÇ

Select * From addServer.targetDB.dbo.Table °°Àº ÇüÅ·ΠÁ¢±Ù °¡´É

openquery ; Select * From OPENQUERY ( addServer, 'SELECT lastname FROM customer)

 

ad-hoc query ; openrowset, opendatasource ... oledb¸¸ Àû¿ë °¡´É

 SELECT * FROM OPENROWSET

 ('Microsoft.jet.oledb.4.0', 'c:\testdb.mdb';'admin';' ', customer) as c

 SELECT * FROM OPENDATASOURCE

 ('Microsoft.jet.oledb.4.0', 'Data Source = c:\testdb.mdb; User ID=admin; Password=')...customer as c

 

===== ¿ÀÈÄ 2:02 2004-09-09, p.210 =====

decimal - À¯È¿ 38ÀÚ¸®. numeric°ú µ¿ÀÏ

float - -1.79e +308 ~ 1.79e +308, float(53)ÀÇ °æ¿ì double precision°ú µ¿ÀÏ

real - float(24)¿Í µ¿ÀÏ, -3.40e+38 3.40e+38

float(n)

 n = 1~24, Á¤¹Ðµµ 7ÀÚ¸®, 4byte

 n = 25~53, Á¤¹Ðµµ 15ÀÚ¸®, 8byte

money - -2^63 / 10^(-4) ~ (2^63-1) / 10^(-4), 8byte. (¼Ò¼öÁ¡ÀÌ µé¾î°£´Ù!)

 

Ä÷³ÀÇ Á¤ÀÇ ; Default, Identity, (Not) Null, Check, Rule, Trigger, Index

ruleÀº ÀÌÀü ȣȯ¼ºÀ» À§ÇÑ °´Ã¼

 

===== ¿ÀÀü 11:16 2004-09-08 =====

replication : publish - subscribe °Ô½Ã - ±¸µ¶

OLAP online analytical processing

OLTP online transaction processing

metadata service - manipulates system catalog

dts data transformation service

dtc distributed transaction coordinator

 

master tempdb msdb model

 

page 8kb - header 96 bytes

extent 64kb - table, index's default unit.

 

mixed extent -> 8 pages over : regular extent

mdf master data file

ndf

ldf log data file

 

GAM global allocation map - process 4gb (64000 extents) 1 is unallocated, 0 is allocated.

SGAM shared global allocation map - process 4gb (64000 extents) 1 is mixed, and could be allocated, 0 is not mixed extent, or allocated.

 

table type data stream - protocol ; sql2000 - 8.0, sql7.0 - 7.0, sql6.5, 6.0, 4.21 - 4.2

transaction log

awe address windowing extensions - advanced server 8gb, datacenter serve 64gb ; È®Àå ¸Þ¸ð¸®´Â °¢ ÀνºÅϽº¿¡ Á¤ÀûÀ¸·Î ÇÒ´çµÊ

 

data definition language

data manipulate language

data control language

 

sql-dmf distributed manage framework

 

automation : server agent, jobs, event and warning, trigger, manager?

 

import/export : dts, replication, bulkcopy(bcp), distributed query

dbcc database

 

sp_helpdb

sp_dboption

sp_configure

 

model databaseÀÇ ¿É¼ÇÀÌ »õ µ¥ÀÌÅͺ£À̽ºÀÇ ¼³Á¤¿¡ Àû¿ëµÊ.

----
[ÇÁ·Î±×·¡¹ÖºÐ·ù]

PythonPowered ShowText of this page
EditText of this page
FindPage by browsing, searching, or an index
Or try one of these actions: DeletePage, DeleteUploadedFile, LikePages, SpellCheck, UploadFile