|
|
| [37833] Re:Re:Re:DB에서 varchar(512)로 선언된 string field에 binary(512 Byte) 데이타를 올리려고 합니다. |
|
김요한 [phonon]
|
1281 읽음 2004-11-02 09:30 |
DBMS로 SQL server 2000을 사용한다고 가정하겠습니다.
BLOB은 'binary large object'의 약자입니다. images, movies, files과 같은 큰 용량의 binary data를 말합니다. DBMS에 따라 명칭이 다르겠지만, MSSQL에서는 'binary', 'varbinary','image' 등의 type를 제공하고 있습니다. 아래의 표를 참조하면서 어느 data type이 적합한지 선택하시면 됩니다.
각 DB Table의 fild(row) Data type의 결정은 DB 설계시에 고려되는 사항이므로, DBA가 계시면 상의하시기 바랍니다.
| Data Types |
Description |
| bigint |
Integer data from -2^63 through 2^63-1 |
| int |
Integer data from -2^31 through 2^31 - 1 |
| smallint |
Integer data from -2^15 through 2^15 - 1 |
| tinyint |
Integer data from 0 through 255 |
| bit |
Integer data with either a 1 or 0 value |
| decimal |
Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1 |
| numeric |
Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1 |
| money |
Monetary data values from -2^63 through 2^63 - 1 |
| smallmoney |
Monetary data values from -214,748.3648 through +214,748.3647 |
| float |
Floating precision number data from -1.79E + 308 through 1.79E + 308 |
| real |
Floating precision number data from -3.40E + 38 through 3.40E + 38 |
| datetime |
Date and time data from January 1, 1753, through December 31, 9999, with an accuracy of 3.33 milliseconds |
| smalldatetime |
Date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minute |
| char |
Fixed-length character data with a maximum length of 8,000 characters |
| varchar |
Variable-length data with a maximum of 8,000 characters |
| text |
Variable-length data with a maximum length of 2^31 - 1 characters |
| nchar |
Fixed-length Unicode data with a maximum length of 4,000 characters |
| nvarchar |
Variable-length Unicode data with a maximum length of 4,000 characters |
| ntext |
Variable-length Unicode data with a maximum length of 2^30 - 1 characters |
| binary |
Fixed-length binary data with a maximum length of 8,000 bytes |
| varbinary |
Variable-length binary data with a maximum length of 8,000 bytes |
| image |
Variable-length binary data with a maximum length of 2^31 - 1 bytes |
| cursor |
A reference to a cursor |
| sql_variant |
A data type that stores values of various data types, except text, ntext, timestamp, and sql_variant |
| table |
A special data type used to store a result set for later processing |
| timestamp |
A database-wide unique number that gets updated every time a row gets updated |
| uniqueidentifier |
A globally unique identifier |
그럼, 좋은 하루 되세요.
곽성주 님이 쓰신 글 : : 소스는 다음과 같습니다. : ----------------------------------------------------------- : sInsertSQL = "INSERT INTO TENPRINT_CLASS (FINGER_NO, TEN_SYS_NO, FINGERCLASS_NO, FEATURE, FEATURE_LENGTH) "; : sInsertSQL += "VALUES ('1', 2049, '1', ?, '512')"; : : ADOQuery1->SQL->Text = sInsertSQL; : TParameter *tParam1 = ADOQuery1->Parameters->ParamByName("Param1"); : tParam1->LoadFromFile(sInsertFileName, ftBytes); : : ADOQuery1->ExecSQL() : ----------------------------------------------------------- : sInsertFileName 파일의 내용을 디비필드에 올리려 합니다. : 파일의 내용은 "\0 ...." 으로 시작하기 때문에 : tParam1의 내용에는 제대로 저장되지만, 디비필드에는 아무것도 저장되지 않습니다. : 제 생각에는 디비필드가 스트링필드이므로 올리면서 잘리는 듯 합니다. : "binary를 저장을 할땐 BLOB type으로 하세요."라고 하셨는데.... : 어떻게 하는 것인지... 설명 좀... 부탁..... 드립니다. : : : 김요한 님이 쓰신 글 : : : Data type이 안 맞아서 나타나는 현상입니다. : : varchar를 string/char로 받으시면 되고요, : : binary를 저장을 할땐 BLOB type으로 하세요. : : 원하시는 것을 하시려면 문자로 변환 후 저장하시면 됩니다. : : : : 엄연히, char와 binary는 다른 것이지요. : : : : 그럼, : : 좋은 하루되세요. : : : : 곽성주 님이 쓰신 글 : : : : DB에서 varchar(512)로 선언된 string field에 binary(512 Byte) 데이타를 올리려고 하는데 : : : : : : 안되는군요 .. : : : : : : 뭔가 올라가긴 하는데, 조회가 안되요, 왜 그럴까요? | |