SQLTeam.com | Weblogs | Forums

Doubt sql creation user

INSERT INTO [SGI]..[SGI2].[USERS]
([PK_USER]
,[USER_NAME]
,[USER_LOGIN]
,[USER_PWD]
,[USER_PROFILE])
VALUES
(1 ,NUMBER,
,avidrigo, VARCHAR2,
,avidrigo, VARCHAR2,
,abc, VARCHAR2,
,0 ,NUMBER,)
GO

When I execute show this error:
Msg 128, Level 15, State 1, Line 8
The name 'NUMBER' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

you don't need to mention datatypes in the insert list.
First you need to create the table and then insert into it.
You need to modify the column length as per your requirement

Exmaple:

Create table [USERS]([PK_USER] int
,[USER_NAME] varchar(100)
,[USER_LOGIN] varchar(100)
,[USER_PWD] varchar(100)
,[USER_PROFILE]) int
GO

INSERT INTO [USERS]
([PK_USER]
,[USER_NAME]
,[USER_LOGIN]
,[USER_PWD]
,[USER_PROFILE])
VALUES
(1,
'avidrigo',
'avidrigo',
'abc',
0 )
GO

That looks like Oracle [the use of "varchar2"]. I believe Oracle has a way to dynamically create a table, but I'm not familiar with Oracle any more. Please be aware that this is a SQL Server site. You may be able to get better help on Oracle-themed site.