如何在主机中的db中创建新表? [英] How create a new table in db in host?

查看:92
本文介绍了如何在主机中的db中创建新表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我的主人有一个数据库。我想在其中创建一个新表。

第一个方法是从主机下载db然后创建新表然后将其上传到主机。

但是有一笔费用。

i想要创建一个没有下载的新表,并从/向主机上传db。

下面是localhost db中的create table代码。我怎么能改变它在主机上运行。

这个想法有新的方法吗?





使用[ASPNETDB]

GO



/ ******对象:表[dbo]。[Login_tbl]脚本日期: 12/22/2018 07:38:07 ****** /

SET ANSI_NULLS ON

GO



SET QUOTED_IDENTIFIER ON

GO



CREATE TABLE [dbo]。[Login_tbl](

[ id] [int] IDENTITY(1,1)NOT NULL,

[用户名] [nvarchar](50)空,

[密码] [nvarchar](50) NULL,

CONSTRAINT [PK_Login_tbl] 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





谢谢



我有什么尝试过:



i不要知道我该做什么。







help

hello
i have a database in my host. i want to create a new table in it.
first methode is that download db from host then create new table then upload it to host.
but there is an expense.
i want to create a new table without download and upload db from/to host.
the below is code of create table in localhost db. how can i change it to run in host.
is there a new methode for this idea?


USE [ASPNETDB]
GO

/****** Object: Table [dbo].[Login_tbl] Script Date: 12/22/2018 07:38:07 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Login_tbl](
[id] [int] IDENTITY(1,1) NOT NULL,
[Username] [nvarchar](50) NULL,
[Password] [nvarchar](50) NULL,
CONSTRAINT [PK_Login_tbl] 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


thanks

What I have tried:

i don't khnow what shoul i do.



help

推荐答案

确实运行在主机上 - SQL代码总是在您发送给它的SQL Server实例上运行。



唯一可以阻止它在真实世界上工作的东西SQL Server但是开发版本是授权(如果你的SQL用户没有创建表的权限)或表已经存在。



但是...那是一张讨厌的桌子!切勿以明文形式存储密码 - 这是一个主要的安全风险。有关如何在此处执行此操作的信息:密码存储:如何做到这一点。 [ ^ ]
That does run "on the host" - SQL code always does run on the SQL Server instance you send it to.

The only things which may stop it working on the "real world" SQL Server but working on the development version is authorisation (if your SQL user does not have permission to create tables) or that the table already exists.

But ... that's a nasty table! Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^]


您可能会发现此示例很有用: https:// www .dotnetperls.com / sqlclient [ ^ ]

正如OriginalGriff所说,你需要正确的权限才能在服务器上创建一个表。
You may find this example useful: https://www.dotnetperls.com/sqlclient[^]
As OriginalGriff already said, you need the right permissions to create a table on the server.


这篇关于如何在主机中的db中创建新表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆