PowerDesigner中的数据类型对照表

The following numeric data types are available:

Standard data type

DBMS-specific physical data type
Content
Length

Integer int / INTEGER 32-bit integer
Short Integer smallint / SMALLINT 16-bit integer
Long Integer int / INTEGER 32-bit integer
Byte tinyint / SMALLINT 256 values
Number numeric / NUMBER Numbers with a fixed decimal point Fixed
Decimal decimal / NUMBER Numbers with a fixed decimal point Fixed
Float float / FLOAT 32-bit floating point numbers Fixed
Short Float real / FLOAT Less than 32-bit point decimal number
Long Float double precision / BINARY DOUBLE 64-bit floating point numbers
Money money / NUMBER Numbers with a fixed decimal point Fixed
Serial numeric / NUMBER Automatically incremented numbers Fixed
Boolean bit / SMALLINT Two opposing values (true/false; yes/no; 1/0)

 

Character data types :

 

Standard data type
DBMS-specific physical data type
Content
Length

Characters char / CHAR Character strings Fixed
Variable Characters varchar / VARCHAR2 Character strings Maximum
Long Characters varchar / CLOB Character strings Maximum
Long Var Characters text / CLOB Character strings Maximum
Text text / CLOB Character strings Maximum
Multibyte nchar / NCHAR Multibyte character strings Fixed
Variable Multibyte nvarchar / NVARCHAR2 Multibyte character strings Maximum

 

Time data types:

 

Standard data type
DBMS-specific physical data type
Content
Length

Date date / DATE Day, month, year
Time time / DATE Hour, minute, and second
Date & Time datetime / DATE Date and time
Timestamp timestamp / TIMESTAMP System date and time

 

Other data types :

 

Standard data type
DBMS-specific physical data type
Content
Length

Binary binary / RAW Binary strings Maximum
Long Binary image / BLOB Binary strings Maximum
Bitmap image / BLOB Images in bitmap format (BMP) Maximum
Image image / BLOB Images Maximum
OLE image / BLOB OLE links Maximum
Other User-defined data type
Undefined undefined Undefined. Replaced by the default data type at generation.

sql server 中取十位随机字符串

———————-字符串中有重复的字符——————–
declare @l int
declare @s varchar(26)
declare @r varchar(200)
set @l = 10 ———–设置返回长度,最大长度受@r的限制
set @s = ‘abcdefghijklmnopqrstuvwxyz’
set @r = ”
while len(@r) < @l
begin
set @r = @r + substring(@s, cast(rand() * 100 as int) % 26 +1 , 1)
end
print @r

——————–字符串中无重复字符———————————-

declare @s varchar(26)
declare @r varchar(8)
declare @t varchar(1)
set @s = ‘abcdefghijklmnopqrstuvwxyz’
set @r = ”

while len(@r) < 8
begin
set @t = substring(@s, cast(rand() * 100 as int) % 26 +1 , 1)
if charindex(@t, @r) < 1
set @r = @r + @t
end
print @r

——————–字符串中无重复字符函数———————————-
ALTER FUNCTION dbo.GetRandStr
(@Count INTEGER = 8)
RETURNS VARCHAR
AS
BEGIN
DECLARE @STR VARCHAR(100), @STR1 VARCHAR(36)
DECLARE @I INTEGER, @J INTEGER, @M INTEGER, @N INTEGER
SET @STR1 = ‘0123456789abcdefghijklmnopqrstuvwxyz’
SET @I = 1
SET @M = 1
SET @STR = ”
WHILE @I <= 36
BEGIN
HERE:
SET @M = CAST(dbo.RAND() * 100 / 2.75 AS INTEGER)
IF (@M < 1) OR (@M = @N) OR (CHARINDEX(SUBSTRING(@STR1, @M ,1), @STR)) > 0 GOTO HERE
SET @N = @M
SET @STR = @STR + SUBSTRING(@STR1, @M ,1)
SET @I = @I + 1
END
RETURN @STR
END