Posts: 1,679
Threads: 232
Joined: Nov 2009
Reputation:
0
How can i set a string for varchar variable when i insert it through code?
I want when my player creates a house to set a string 'Unowned' and 'No Owner' to variables(varchared vars) HName and HOwner at the database how i can do that?
Posts: 2,593
Threads: 34
Joined: Dec 2007
in create table use VARCHAR(25) DEFAULT 'No Owner'
Posts: 2,593
Threads: 34
Joined: Dec 2007
Try
pawn Код:
ALTER TABLE table_name ALTER COLUMN HOwner VARCHAR(25) DEFAULT 'No Owner'
Posts: 1,679
Threads: 232
Joined: Nov 2009
Reputation:
0
Ok thanks and one last question if i make it manually through table do i have at default to use ' or just write inside the field the text?
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
"Unknown" values should be represented by NULL. Processing of this information is to be done in code, not in the database.
Furthermore, Owner should be linked to the player's unique id in the player table. A player's name is only to appear once in the entire database. Any other tables that require the player's information must link to the original table via a foreign key.
Posts: 1,679
Threads: 232
Joined: Nov 2009
Reputation:
0
Umm i dropped the houses table and recreated manually and set default the texts i want and i just read vince's reply . Here is a picture of my structure of the table should i change something? Have i done something wrong?