RSS   



  可打印版本 | 推薦給朋友 | 訂閱主題 | 收藏主題 | 純文字版  


 


 
主題: [求助] [求助]SQL數據類型的問題   字型大小:||| 
Outbreak
銅驢友〔初級〕
等級: 8等級: 8
法號:閑施

今日心情

 . 積分: 114
 . 文章: 367
 . 收花: 952 支
 . 送花: 17 支
 . 比例: 0.02
 . 在線: 1672 小時
 . 瀏覽: 2190 頁
 . 註冊: 7244
 . 失蹤: 1174
 . 流星街
#1 : 2004-12-3 09:34 AM     全部回覆 引言回覆

版主 lovelegend : 謝謝你熱心提供資料... ^^

評分:+1   

引用:
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
至於條件以及設定就看你要如何設計都可以



[如果你喜歡本文章,就按本文章之鮮花~送花給作者吧,你的支持就是別人的動力來源]
本文連接  
檢閱個人資料  訪問主頁  發私人訊息  Blog  快速回覆 新增/修改 爬文標記

   

快速回覆
表情符號

更多 Smilies

字型大小 : |||      [完成後可按 Ctrl+Enter 發佈]        

溫馨提示:本區開放遊客瀏覽。
選項:
關閉 URL 識別    關閉 表情符號    關閉 Discuz! 代碼    使用個人簽名    接收新回覆信件通知
發表時自動複製內容   [立即複製] (IE only)


 



所在時區為 GMT+8, 現在時間是 2024-9-29 09:28 PM
清除 Cookies - 連絡我們 - TWed2k © 2001-2046 - 純文字版 - 說明
Discuz! 0.1 | Processed in 0.025371 second(s), 8 queries , Qzip disabled