Python Forum
In SQL Server, mix data types.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In SQL Server, mix data types.
#1
While reading an article of SQL server on wiki thought that, In SQL Server, is it possible to merge data types? i.e., to have a cell's value be both a text and a number, with the text being a constant?

My table is named Contract. The value for the ContractID field should be "TCwxyz," where "TC" stands for text characters and "wxyz" for integers.

The following is what I have, however it doesn't appear to be working:

CREATE TYPE TenantContracts AS CHAR(6)
CHECK (SUBSTRING(VALUE,1,2)='TC'
AND (SUBSTRING(VALUE,2,4) AS SMALLINT)

Any help would be much appreciated. Thank you.
buran write Feb-10-2024, 06:57 AM:
spam link removed
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What data types can I use for default values? Mark17 1 539 Oct-09-2023, 02:07 PM
Last Post: buran
  I need to add data types to cython conversion python to c Good_AI_User 1 1,012 Aug-19-2022, 07:52 AM
Last Post: Gribouillis
  How to modify python script to append data on file using sql server 2019? ahmedbarbary 1 1,231 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  How to insert different types of data into a function DrData82 0 1,257 Feb-10-2022, 10:41 PM
Last Post: DrData82
  How to take the tar backup files form remote server to local server sivareddy 0 1,916 Jul-14-2021, 01:32 PM
Last Post: sivareddy
  How to save Python Requests data sent to server? RedLeonard 5 4,994 Jul-05-2020, 10:33 AM
Last Post: RedLeonard
  Need advice on pushing data to a server API msoultan 0 1,218 Jun-28-2020, 06:33 PM
Last Post: msoultan
  Save Arduino data in mysql server via raspberrypi rithikvg 1 3,423 Jun-24-2020, 10:59 PM
Last Post: Larz60+
  Support required to data log in SQL server single table via raspbeery pi rithikvg 8 4,425 Jun-23-2020, 05:23 PM
Last Post: buran
  Get Python json data i n SQL Server Djin 1 2,025 May-13-2020, 05:56 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020