nvarchar 强转bigint
时间: 2024-06-10 22:09:37 浏览: 111
nvarchar强制转换为bigint需要使用CAST或CONVERT函数。例如,使用CAST函数可以将nvarchar类型的值转换为bigint类型的值:
CAST(column_name AS bigint)
或者使用CONVERT函数:
CONVERT(bigint, column_name)
相关问题
CREATE TABLE [dbo].[QualityTestingAppeal] ( [ID] [bigint] NOT NULL IDENTITY(1, 1), [QualityTestingId] [bigint] NOT NULL, [OldState] [int] NOT NULL, [CreateTime] [datetime] NOT NULL, [CreateId] [bigint] NOT NULL, [AppealReason] [nvarchar] (512) COLLATE Chinese_PRC_CI_AS NULL, [AppealEnclosure] [varchar] (256) COLLATE Chinese_PRC_CI_AS NULL, [HandleAppealAUID] [bigint] NULL, [HandleAppealTime] [datetime] NULL, [HandleState] [int] NOT NULL CONSTRAINT [DF__QualityTe__Handl__59B11114] DEFAULT ((0)) ) 通过表设计生成带注释的实体C#类
您好,请参考以下代码,这是通过表设计生成带注释的实体C#类:
```csharp
using System;
/// <summary>
/// 实体类QualityTestingAppeal。(属性说明自动提取数据库字段的描述信息)
/// </summary>
[Serializable]
public partial class QualityTestingAppeal
{
public QualityTestingAppeal()
{ }
#region Model
private long _id;
private long _qualitytestingid;
private int _oldstate;
private DateTime _createtime = DateTime.Now;
private long _createid;
private string _appealreason;
private string _appealenclosure;
private long? _handleappealauid;
private DateTime? _handleappealtime;
private int _handlestate = 0;
/// <summary>
/// 自增长ID
/// </summary>
public long ID
{
set { _id = value; }
get { return _id; }
}
/// <summary>
/// 质检ID
/// </summary>
public long QualityTestingId
{
set { _qualitytestingid = value; }
get { return _qualitytestingid; }
}
/// <summary>
/// 原状态
/// </summary>
public int OldState
{
set { _oldstate = value; }
get { return _oldstate; }
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime
{
set { _createtime = value; }
get { return _createtime; }
}
/// <summary>
/// 创建者ID
/// </summary>
public long CreateId
{
set { _createid = value; }
get { return _createid; }
}
/// <summary>
/// 申诉原因
/// </summary>
public string AppealReason
{
set { _appealreason = value; }
get { return _appealreason; }
}
/// <summary>
/// 申诉附件
/// </summary>
public string AppealEnclosure
{
set { _appealenclosure = value; }
get { return _appealenclosure; }
}
/// <summary>
/// 处理申诉的管理员ID
/// </summary>
public long? HandleAppealAUID
{
set { _handleappealauid = value; }
get { return _handleappealauid; }
}
/// <summary>
/// 处理申诉时间
/// </summary>
public DateTime? HandleAppealTime
{
set { _handleappealtime = value; }
get { return _handleappealtime; }
}
/// <summary>
/// 处理状态(0:未处理,1:已处理)
/// </summary>
public int HandleState
{
set { _handlestate = value; }
get { return _handlestate; }
}
#endregion Model
}
```
希望这个代码可以帮到您。
USE Xk GO --创建班级信息表Class CREATE TABLE Class (ClassNo nvarchar (8) NOT NULL, ClassName nvarchar (20) NOT NULL, DepartNo nvarchar (2) NOT NULL) GO --创建学生信息表Student CREATE TABLE Student (StuNo nvarchar (8) NOT NULL, StuName nvarchar (10) NOT NULL, Pwd nvarchar (8) NOT NULL, ClassNo nvarchar (8) NOT NULL) GO --创建学生选课表StuCou CREATE TABLE StuCou (StuNo nvarchar (8) NOT NULL, CouNo nvarchar (3) NOT NULL, Will0rder smallint NOT NULL, State nvarchar (2) NOT NULL, RandomNum nvarchar(50) NULL) GO
这是一个使用 SQL 语言创建三个表的代码,分别是班级信息表 Class,学生信息表 Student,和学生选课表 StuCou。班级信息表包括班级编号 ClassNo、班级名称 ClassName、所属院系编号 DepartNo;学生信息表包括学生编号 StuNo、学生姓名 StuName、登录密码 Pwd、所属班级编号 ClassNo;学生选课表包括学生编号 StuNo、课程编号 CouNo、选课志愿顺序 WillOrder、选课状态 State、随机数 RandomNum。这些表的结构可以用于实现学生选课系统。
阅读全文