引用:
OverZero寫到:
關於MS-SQL裡面的相關數據類型
有大大有在研究嗎?
我還是不怎麼懂它的意思
例:char varchar nchar nvarchar text ntext
這些是什麼意思呢?
還有就是我要SQL裡面的一個表格定期清空裡面的數字 規為0
請問SQL辦的到嗎?不然我都要手動清楚
參考一下資料型態解說吧
再來是英文說明,有劃重點了喔...
The most commonly used character datatypes, char and varchar, store data in a fixed or variable length format respectively. Use char if a column has a consistent length, such as a two-character State field. If char is defined as char(20), it uses 20 bytes of storage even if only five characters are entered into the field; data is padded with blanks up to the full field size. For a variable length column, such as a Description or Name field, varchar would be a better choice because it doesn't pad the data with spaces, and the amount of bytes required is the actual length of the character data. Char and varchar can store up to 8,000 characters.
The Unicode variants are nvarchar and nchar. These have the same properties, but data is stored in Unicode format. Unicode supports a wider range of characters, but each character requires two bytes of storage. This limits the available storage to 4,000 characters.
To store character strings and binary data that might exceed 8,000 bytes, use the text, ntext, and image datatypes. For example, to store large text files (.txt), you would define a column as text or ntext depending on the requirement for Unicode support. For storing images (.gif), a better choice would be the image datatype.
最後...
要定期把欄位清成0...
那就寫個SQL Command把它數值設定為0就好了喔
Update [Table_Name] set [Field_Name] = 0
至於條件以及設定就看你要如何設計都可以