久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將結構類型創建為 T-SQL 的列值?

Creating a struct type as a column value for T-SQL?(將結構類型創建為 T-SQL 的列值?)
本文介紹了將結構類型創建為 T-SQL 的列值?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在為我的游戲制作一個數據庫,我需要存儲很多 c 風格的結構體.

I'm making a database for my game and I need to store a lot of c style structs.

struct stats{
    int strength, stamina, agility, intelligence, etc..;
}

我一直在研究如何在 t-sql 中創建用戶定義的數據類型,MSDN 特別指出用戶定義的數據類型不能用作列類型:

I've been looking at how to create user defined data types in t-sql and MSDN specifically says that user defined data types CANNOT be used as a column type:

用戶定義的表類型不能用作表中的列或結構化用戶定義類型中的字段.

有沒有解決方法,或者在那里創建基于結構的系統的其他方法?我還需要一個技能結構,我有大約 120 多個技能需要存儲在我的播放器表下.我想要的表看起來像這樣:

Is there not a work around, or some other way to create a struct based system in there? I also need a struct for skills and i have around 120+ skills that need to be stored under my player table. My desired table would look something like this:

CREATE TABLE [dbo].[Player](
    player_name nvarchar (20),
    gold int,
    player_stats stats,                 // array of 4 ints
    player_skills skills,               // array of 120+ tinyints
    player_location location,           // array of 3 floats (x,y,z)
    player_customization customization, // array of 20+ tinyints
    player_equipment equipment,         // array of 8 ints
    etc....)

有沒有一種簡單的方法可以做到這一點,還是我只需要將所有這些添加為單獨的列類型?感謝您的幫助.

Is there a simple way of doing this or do i just need to add all those as individual column types? Thanks for the help.

推薦答案

這是你的桌子:

CREATE TABLE [dbo].[Players](
    player_name nvarchar (20),
    gold int,
    player_stats stats,                 // array of 4 ints
    player_skills skills,               // array of 120+ tinyints
    player_location location,           // array of 3 floats (x,y,z)
    player_customization customization, // array of 20+ tinyints
    player_equipment equipment,         // array of 8 ints
    etc....
)

這表明您應該有幾個其他的表和列:

This suggests that you should have several other tables and columns:

  • Player_SkillsSkills:每個玩家和每個技能一行,可能還有一個技能級別列.
  • Location:每個位置一行,包含有關該位置的信息.LocationId 將在 Players 表中.
  • Player_EquipmentEquipment:每個玩家和每個裝備一行.
  • Player_Skills and Skills: One row per player and per skill, with perhaps a skill level column as well.
  • Location: One row for each location, with information about the location. LocationId would be in the Players table.
  • Player_Equipment and Equipment: One row per player and per equipment.

我不知道player_statsplayer_customization 是什么.也許它們只是適合 Players 的列;也許他們應該是他們自己的桌子.

I don't know what player_stats and player_customization are. Perhaps they are just appropriate columns for Players; perhaps they should be their own tables.

您從結構"等編程結構的角度考慮關系數據庫是不合適的.

You're thinking of a relational database in terms of programming constructs such as "structures" is not appropriate.

這篇關于將結構類型創建為 T-SQL 的列值?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創建視圖?)
Create calculated value based on calculated value inside previous row(根據前一行內的計算值創建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 一区二区高清 | 欧美1区| 亚洲精品福利视频 | 中文字幕精品一区 | 日本精品视频在线观看 | 日韩欧美福利视频 | 一区二区三区四区电影 | 亚洲性在线 | 亚洲日本一区二区三区四区 | 麻豆一区二区三区 | 国产福利91精品一区二区三区 | 国产精品99久久久精品免费观看 | 老头搡老女人毛片视频在线看 | 97精品久久 | 亚洲成人精品 | 成人免费观看视频 | 久草新在线 | 免费看片在线播放 | 九色 在线 | 中文字幕亚洲区一区二 | 欧美一级黄色片免费观看 | 亚洲自拍偷拍免费视频 | 久久久精品一区二区三区 | 91九色在线观看 | 国产一区二区三区四区在线观看 | 久久久久久久一区二区 | 久久国内 | 日韩电影免费在线观看中文字幕 | 天天综合网天天综合色 | 91麻豆精品国产91久久久久久久久 | 久久成人免费视频 | 亚洲网站免费看 | 欧美三区在线观看 | 在线免费观看日本视频 | 欧美精品在线一区二区三区 | 欧美在线| 99久热在线精品视频观看 | 国产精品亚洲一区二区三区在线观看 | m豆传媒在线链接观看 | 成人在线黄色 | 精品久久久久一区二区国产 |