我想设计一个表格,其描述如下 [英] I want to design table whose description is given below
本文介绍了我想设计一个表格,其描述如下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想设计一个表。这将是表结构。
userID类别日期
uid1 a 22 feb
uid1 b 23 feb
uid1 c null
uid2 a 22 feb
uid2 b 23 feb
uid2 c 24 feb
我的尝试:
我将从excel中导出所有数据,然后插入临时表后仍然搜索
解决方案
这样做:
USE [NameOfYourSQLDatabase]
GO
/ * *****对象:表[ dbo]。[ExampleTable]脚本日期: 28/03/2017 10:53:25 ****** /
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [ dbo]。[ExampleTable](
[ID] [ int ] IDENTITY ( 1 , 1 ) NOT NULL ,
[UserID] [ nchar ]( 10 ) NOT NULL ,
[类别] [ nchar ]( 10 ) NOT NULL ,
[日期] [日期] NULL ,
CONSTRAINT [PK_ExampleTable] PRIMARY KEY CLUSTERED
([ID] ASC ) WITH (PAD_INDEX = < span class =code-keyword> OFF ,STATISTICS_NORECOMPUTE = OFF ,IGNORE_DUP_KEY = OFF ,ALLOW_ROW_LOCKS = ON ,ALLOW_PAGE_LOCKS = ON ) ON [ PRIMARY ]
) ON [主要]
GO
i want to design a table .this will be the table structure.
userID category Date
uid1 a 22 feb
uid1 b 23 feb
uid1 c null
uid2 a 22 feb
uid2 b 23 feb
uid2 c 24 feb
What I have tried:
I will be export all the data from excel and after that inserting the temp table after that still searching
解决方案
So do it:
USE [NameOfYourSQLDatabase] GO /****** Object: Table [dbo].[ExampleTable] Script Date: 28/03/2017 10:53:25 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[ExampleTable]( [ID] [int] IDENTITY(1,1) NOT NULL, [UserID] [nchar](10) NOT NULL, [Category] [nchar](10) NOT NULL, [Date] [date] NULL, CONSTRAINT [PK_ExampleTable] PRIMARY KEY CLUSTERED ( [ID] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
这篇关于我想设计一个表格,其描述如下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文