Input In Sql-server Database

Jun 20, 2007

hy, i wrote an input function to put some data in my database with click of button

it doesnt work and i cant find the mistake =/

anyone of you can help?

now theres one thing that isnt right, and that is that the datasiz of messagetext is set to max, and here i put it in to 50, cause dont know how to put it to max cause you can only put in ant integer

, also in the insert into, i did not put all of the columns cause the data i input is only for certain columns, ( don't think thats a problem)

Greetz

Roy1
2 Private mocon As clsAdocon
3 Dim naam As String
4 Dim type As String
5 Dim folder As String
6 Dim sUDL = ConfigurationManager.ConnectionStrings("masterConnectionString").ConnectionString
7
8 Protected Sub btnopslaan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnopslaan.Click
9
10 folder = "Out"
11 Select Case True
12 Case rdbMail.Checked
13 type = "Mail"
14 Case rdbFax.Checked
15 type = "Fax"
16 Case rdbSms.Checked
17 type = "Sms"
18 End Select
19
20 If type = "Mail" Then
21 Dim strSql As String
22 strSql = "INSERT INTO Message(ToName, ToEmail, Subject, MessageText, TypeBericht, Folder) VALUES(@ToName,@ToEmail,@Subject,@MessageText,@TypeBericht,@Folder);"
23
24 Try
25 'connectie met database
26 Dim objCn As New SqlConnection(sUDL)
27 Dim objCmd As SqlCommand = objCn.CreateCommand()
28 objCmd.CommandText = strSql
29
30 objCmd.Parameters.Add("@ToName", SqlDbType.NVarChar, 50).Value = naam
31 objCmd.Parameters.Add("@ToEmail", SqlDbType.NVarChar, 50).Value = txtAan.Text
32 objCmd.Parameters.Add("@Subject", SqlDbType.NVarChar, 50).Value = txtOnderwerp.Text
33 objCmd.Parameters.Add("@MessageText", SqlDbType.NVarChar, 50).Value = txtbericht.Text
34 objCmd.Parameters.Add("@Folder", SqlDbType.NChar, 10).Value = folder
35 objCmd.Parameters.Add("@TypeBericht", SqlDbType.NChar, 10).Value = type
36
37 objCn.Open()
38 objCmd.ExecuteNonQuery()
39 objCn.Close()
40 Catch ex As Exception
41
42 End Try
43 End If
44
45 End Sub
 

View 4 Replies


ADVERTISEMENT

The Data On The Website Cannot Be Input In The Server Database..

Mar 6, 2008

hi there..
I have write a code in the submit button using vb code so that when people key in their email.. it will be saved in my created database called test.mdf. but when i debug it, i tried to write an my email address in the textbox in my website but when i click at the submit button, the web page display the email was not enter in my database.
here is the code, can anybody help me. i'm really lost here..
 Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim TestDataSource As New SqlDataSource()TestDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("TestConnectionString1").ToString()
 
TestDataSource.InsertCommandType = SqlDataSourceCommandType.Text
TestDataSource.InsertCommand = "INSERT INTO Email(EmailAddress, IPAddress, DateTimeStamp) VALUES (@EmailAddress,@IPAddress,@DateTimeStamp)"
 TestDataSource.InsertParameters.Add("EmailAddress", emailAddressTextBox.Text)
TestDataSource.InsertParameters.Add("IPAddress", Request.UserHostAddress.ToString())TestDataSource.InsertParameters.Add("DateTimeStamp", DateTime.Now())
 Dim rowsAffected As Integer = 0
 
Try
rowsAffected = TestDataSource.Insert()
 Catch ex As Exception
 Server.Transfer("test_problem.aspx")
 
Finally
 
TestDataSource = Nothing
 
End Try
 
If rowsAffected <> 1 ThenServer.Transfer("test_problem.aspx")
ElseServer.Transfer("Test_Confirm.aspx")
 
End If
 
 
 
End Sub

View 2 Replies View Related

Clean Input Before Submitting To Database

Sep 11, 2006

Is there some recommended way to clean input before submitting it to the database? We'd like to develop a library that can be used on our ASP/ASP.NET apps to filter input before it's sent to the SQL Server and Oracle databases. Is there a way to create a .NET DLL that can be used for both ASP.NET and classic ASP apps. Thanks.

View 3 Replies View Related

Want To Compare Webform Input To Database

Apr 9, 2008

 Hello, I am writing a website (in vb) to allow for room use reservations and I am looking for a way to compare the selected start and end times which are date-time format to records already in the database for that  day/time  and specific room.  If the selected time does not fall within an already reserved time frame I then want to insert it into the table.  I have already written a procedure to do the inserting and that works fine.  I just want to validate it before calling the insert.  Any ideas?  The fields to be validated on the form are textboxes containing date time which populate as read only after the time selection is chosen from dropdown. Thanks in advance It's greatly appreciated.

View 7 Replies View Related

Hoe To Input Apostrophy (&#39;) In A Database Field From Asp

Aug 16, 2000

My name is Syed Kamran Ahmed and i'm an ASP
Programmer. I've got a problem with entering values in
database from ASP page, if i use apostropy in a text
box and then passes values to Sql server store
Procedures then it will give following error:
Error Type:
Microsoft OLE DB Provider for SQL Server
(0x80040E14)
Line 1: Incorrect syntax near 's'.
my calling store procedure syntax is:
rsinsert_products.Open "exec sp_insert_products
'"&vPdescription&"',dbc,
adOpenDynamic ,adLockOptimistic .
Where vPdescription contains kamran's home.
Please tell me how i'm gonna put "'" in database from
above method.
Thanx.
Kamran Ahmed

View 1 Replies View Related

Hoe To Input HTML Code In A Database From Asp

Aug 17, 2000

I want to put HTML code in my ASP form and then input in to a database in SQL SERVER 7.0, but due to some syntax problems i can't be able to do it.
Please tell me how i'm gonna input a typical HTML code in Database field.
Thanx.

View 1 Replies View Related

Newbie Trying To Input Data Into Database

Feb 8, 2007

Hello everyone, I am new to mssql so please excuse all my silly questions.

I can create databases and tables. This is fairly easy, now I am having trouble with inputting data into the database using the data entry browser (or whatever it is called to enter data directly into a table).

I usually get an error when trying to submit the entry, firstly I have a "id" field which I think I have set to auto increase (Identity is ticked, seed and increment is set to 1).

when I go to add data all fields have "Null" in them and from what I understand it allows the fields to be empty, except the primary key which is the id field in this case and I expect that to be filled in automatically like with mysql but isn’t.

Can some kind person instruct or direct me somewhere on how to enter data into a table without it failing.

Thanks in advanced for any information provided.

Stealth549

View 2 Replies View Related

Problem Matching Input Username With Database

Dec 6, 2005

I tried  matching the input username with the database. Although
the input value is the same as the database, but it doesnt goes into
the if statement to increase the "stat" value. Please advise what went
wrong. Thanks.

protected void btnEnter_Click(object sender, EventArgs e)
    {
        if (txtUsername.Text.Length > 0)
        {
            status++;
            Label3.Text = "";
        }
        else
        {
            Label3.Text = "Please enter a username";
        }

        if (txtPassword.Text.Length > 0)
        {
            status++;
            Label4.Text = "";
        }
        else
        {
            Label4.Text = "Please enter a password";
        }
        
        if (status == 2)
        {
            int stat = 0;
            string mySelectQuery = "SELECT * FROM users";
           
SqlConnection myConnection = new SqlConnection("Data
Source=WINSON-COMP;Initial Catalog=winson;Integrated Security=True");
           
SqlCommand myCommand = new SqlCommand(mySelectQuery, myConnection);
            try
            {
                myConnection.Open();
               
SqlDataReader myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    stat = 0;
                   
string user = (string)myReader["username"];
                   
string pass = (string)myReader["password"];
                   
if (user == txtUsername.Text){                       
stat++;
                    }else {
                       
Label3.Text = "Incorrect Username";
                    }
                   
if (pass == txtPassword.Text){
                       
stat++;
                    }else{
                       
Label4.Text = "Incorrect Password";
                    }
                   
if (stat == 2)
                    {
                       
Server.Transfer("shopping.aspx");
                    }
                }
                myReader.Close();
            }
            finally
            {
                myConnection.Close();
            }

        }
    }

View 2 Replies View Related

Query Database User Input From ListBox

Jan 25, 2006

I have a problem selecting fields from a table where fields are equal to user input from a listbox. example
listbox of zip codes:
33023[red]22300[/red]39844[red]29339[/red]23883[red]38228[/red]
user wants to retreive highlight zip codes from database.connection working perfect.Thank you for your help.
 
        

View 2 Replies View Related

Need Input On Trigger Based Database Auditing

Jun 5, 2008

Hi

I am building a pretty simple intranet application where we need to be able to track changes to tables. The tracking feature do not need to be very advanced, we just need to see who changed something and what it was. Therefore I decided just to use a trigger based solution, but need some input/advice since my SQL skills is somewhat lacking.

Consider the following (mock-up) schema:


-- My content table
CREATE TABLE [Content](
[ContentGuid] [uniqueidentifier] NOT NULL PRIMARY KEY DEFAULT (newid()),
[Data] [nvarchar](4000) NOT NULL,
[ChangedBy] [nchar](10) NOT NULL,
[MaybeNull] [int] NULL
)

-- My history table
CREATE TABLE [History](
[ChangedTable] [nvarchar](50) NOT NULL,
[ReferenceGuid] [uniqueidentifier] NOT NULL,
[ChangedBy] [nchar](10) NOT NULL,
[ChangedOn] [datetime] NOT NULL DEFAULT (getutcdate()),
[IsDelete] [bit] NOT NULL DEFAULT ((0)),
[Changes] [xml] NOT NULL
) ON [PRIMARY]

-- My insert/update trigger
CREATE TRIGGER [RecordChangeOnInsertUpdate]
ON [Content]
AFTER INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;

DECLARE @Changes xml
SET @Changes = (select * from [inserted] for xml raw ('Content'), elements xsinil)

INSERT INTO [History]
([ChangedTable]
,[ReferenceGuid]
,[ChangedBy]
,[ChangedOn]
,[IsDelete]
,[Changes])
SELECT 'Content', ContentGuid, ChangedBy, getutcdate(), 0, @Changes
FROM [inserted]
END

-- My delete trigger
CREATE TRIGGER [RecordChangeOnDelete]
ON [Content]
AFTER DELETE
AS
BEGIN
SET NOCOUNT ON;

DECLARE @Changes xml
SET @Changes = (select * from [deleted] for xml raw ('Content'), elements xsinil)

INSERT INTO [History]
([ChangedTable]
,[ReferenceGuid]
,[ChangedBy]
,[ChangedOn]
,[IsDelete]
,[Changes])
SELECT 'Content', ContentGuid, ChangedBy, getutcdate(), 1, @Changes
FROM [deleted]
END


I have decided to use the "one history table for all table changes" method. The changes for a row is stored in a xml column which obviously limits the total size of columns in a table being tracked, but that is not a problem in my application. In general I like this set up, since I will be able to change the schema continuously without having to change the triggers, and since the application will probably evolve a lot over the coming months this is pretty important to me.

EDIT: I should add that all the tables I will be tracking have a uniqueidentifier column. This makes it possible to related table rows in the different tables being tracked with their history.

A few concerns with the above SQL:

- Can the inserted/deleted table change between "SET @Changes = (select * ..." and the "INSERT INTO ..." statement, such that the data is not valid? If so, how to work around that?

- If I were to (hypothetically) perform a "UPDATE [Content] SET [Data] = 'something'", not only is my update trigger called once for each row updated, but the XML added to the inserted row in the history table ([History].[Changes]) represent all the rows updated in the batch update. How do I get around this?

Are there any other issues I should be aware of?

Regards, Egil.

View 13 Replies View Related

Update SQL Database Using Excel Sheet As Input

Apr 24, 2007

Hi

I am a very beginner in SQL and know a little bit VB.

I created a database table with two columns, one for key and the other for data. I'd like to update the data column using excel sheet which contains the same columns, key and data.

Does anyone have a sample VB code to share.

Thanks

Al

View 3 Replies View Related

Database Level Setting : Allow User Input Chinese Character~

Jul 16, 2007

Dear all,



To allow users enter chinese character into table, I did try to change the field type to nchar and this is workable. But I have few hundred tables.. Is there anyway to change the setting in easier way? by instead change the field type one by one for each table?



I tried change the collation to Chinese_PRC_90_BIN for the database, but it is not support chinese input..



Any Idea?



Thanks.

View 4 Replies View Related

Retrieving Rows Of Database Values That Have Numbers Cloest To Our Input

Jan 11, 2008



Mean_A Std_Dev_A Mean_B Std_Dev_B Mean_C Std_Dev_C X_Co Y_Co Posn



71.7
9.36
73.23
3.62
70.87
4.06
12
14
1

72.69
8.02
79.39
2.66
73.39
5.16
13
15
2

74.37
10.27
77.33
4.10
79.33
3.44
14
16
3














The Above is my database, I need help in retrieving the X_Co and the Y_Co using values of rcv_A, rcv_B and rcv_C to compare with the Mean_A, Mean_B, Mean_C. The values of rcv_A, rcv_B and rcv_C are instances of values that are not exact of the mean columns , and we want is to compare it against our database and retrieve the row that is the closest to the rcv_A, rcv_B and rcv_C.

Here is an example of what i need. Let's say my rcv_A = 71, rcv_B = 73 and rcv_C = 70.8, so the row with mean value closest would be row 1, followed by row 2, then row 3.

So the result i hope to retrieve is in order of the closest value and i only need the X_Co and Y_Co.
This is what i want

X_Co Y_Co
---------------------------
12 14
13 15
14 16

So anyone please can help me in querying for the above results? Thanks

View 5 Replies View Related

Determining What To Input As Server

Jun 9, 2006

I'm trying to connect to a sql database, but I don't know what myserver is in the following code.Dim strConn As String = "server=myserver;database=Northwind"I can't get the code to link up with my Northwind database.I'm running everything locally if that helps.Thanks!Jon

View 2 Replies View Related

Input On Web Form That Updates Sql SERVER

Dec 7, 2005

Can some one give me an over view of what I need to do:

Lets say I have a web form with the field: Arrival Date

A web user enters an arrival date of 2/10/06

How do I do a stored procedure that accepts that arrival date and lets me know (by an alert or email) 24 hrs in advance of the arrival date?

View 2 Replies View Related

SQL Server 2012 :: Call SP On The Basis Of Input?

Feb 15, 2015

I have create Store procedure for all the Source and destination table for loading new and updated record.

For example I have below Store procedure

1-SP_Archive_using_merge_Fdoor
2-SP_Archive_using_merge_Fdoop

now I want to call all the sp on the basis of input like If filename is Fdoor then it shold fire the SP_Archive_using_merge_Fdoor , if file name is Fdoop then it shoilud fire the SP_Archive_using_merge_Fdoop like that .

below is the 2 sp .

--First SP
ALTER PROCEDURE [dbo].[SP_Archive_using_merge_Fdoor]
AS
BEGIN
SET NOCOUNT ON
DECLARE @Source_RowCount int
DECLARE @New_RowCount int

[code].....

View 1 Replies View Related

SQL Server 2008 :: How To Calculate Charge From Given Input Set

Mar 17, 2015

Work on sql server 2008 r2, need recursively charge amount calculation process.want to write an sp, In my sp I need to calculate head sum base on parameter head and given amount: Picture describe my db input set, from the input set I need to calculate total charge amount on given head,

Input set 1 HeadAmountIsPercentHead PercentGiven AmountCalculated AmountWorking Sequence
Utility10NoTotal400101
Sum10

Input Set 2 HeadAmountIsPercentHead PercentGiven AmountCalculated AmountWorking Sequence
Wages 10YesFinancial8001 2
Financial 10YesTotal 10 1
Sum11

[code]....

View 0 Replies View Related

How To Update User Input Data Into Sql Server

May 28, 2007

hi ,
i am new to this.
how should i update the user input values into sql server database?
i am using asp.net and c#
FIELDS are-
userId,
name,
description,
startTime,
endTime,
audiencePassword,
presenterPassword

i know it must be simple...but i haven't worked on this before.


Jaimin

View 3 Replies View Related

Compare Incoming Input File Row Values With Database Row Values In SSIS

Jan 23, 2008

Hi All,

I receive the input file with some 100 columns and some 20k+ rows and I want to check the incoming input row is existed in the database or not based on 2 key columns. If the row is existed then I need to check all the columns (nearly 100 columns) values in input and the database are equal or not. If both are equal I need to treat them seperately if not there is a seperate logic. How Can I do that check for each row and for each column?

Basically the algorithm is like this, if the input file row is not existed in the database then treat that as new row else if the input row is existed in the database then check all the columns are equal or not. If all the columns are equal then treat that as existing row and do nothing else if some columns are not equal then treat this row seperately.

I found some thing to achieve the above thing.
1. Take the input row and check in the database.
2. If the row is not found in the database then treat it as new row.
3. If row is found in the database then
a) Take the source row and prepare a concatenated string for all the columns
b) Take the database row and prepare a concatenated string for all the columns
c) Find out the hash code for the 2 strings and then compare hash codes for equal.

The disadvantage of this is running a loop 2*m*n times where m is the number of rows and n is the number of columns. It should be done 2 times for input file row and database row.

Can anybody suggest a good method to do this?

What does the function "GetHashCode" for InputBuffer in method "Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)" will do?
Will it generates hash code based on all the columns values?

Pls clarify.

Regards
Venkat.

View 1 Replies View Related

Any SQL Wizard Can Help? -- Reformat The Input File And Transfer Into SQL Server

Feb 3, 2005

I am trying to transfer 200 txt files into SQL server by using query analyzer.
The command is 'Bulk insert [tableName] from 'pathfilename.txt'
However, I need to read and modifiy the txt file.
I am new to SQL server but I believe there must be some one who is a wizard can do what I want easily.

Thank you for the help in advance!

Here is the raw data layout, which is comma delimited.
BDate 1/1/1990 BDate 1/1/1990 BDate 1/1/1990 BDate 1/1/1990
Edate 1/1/2005 Edate 1/1/2005 Edate 1/1/2005 Edate 1/1/2005
Fq D Fq D Fq D Fq D
Date R P M E D Date R P M E D Date R P M E D Date R P M E D
1/1/90 1 2 3 4 5 1/1/90 2 3 4 5 6 1/1/90 3 4 5 6 7 1/1/90 4 5 6 7 8
2 3 4 5 6 1 2 3 4 5 3 4 5 6 7 6 7 8 9 1
1/1/05 ...... 1/1/05 .... 1/1/05 ..... 1/1/05 .....

This is the desired output after load into the table, which is tacking each repeating block on top of each other.
Date R P M E D
1/1/90 1 2 3 4 5
2 3 4 5 6
1/1/05 ......
1/1/90 2 3 4 5 6
2 3 4 5 6
1/1/05 ......
1/1/90 3 4 5 6 7
3 4 5 6 7
1/1/05 ......
1/1/90 4 5 6 7 8
6 7 8 9 1
1/1/05 ......

View 6 Replies View Related

SQL Server 2012 :: Stored Procedure With One Or More Input Parameters?

Dec 17, 2013

I've been tasked with creating a stored procedure which will be executed after a user has input one or more parameters into some search fields. So they could enter their 'order_reference' on its own or combine it with 'addressline1' and so on.

What would be the most proficient way of achieving this?

I had initially looked at using IF, TRY ie:

IF @SearchField= 'order_reference'
BEGIN TRY
select data
from mytables
END TRY

However I'm not sure this is the most efficient way to handle this.

View 2 Replies View Related

How To Input Large Data From Another Db Or Db File Into Sql Server Compact?

Jan 21, 2008

Hi :
I want to transfer large data from access db into sql server compact , how can I do ? thanks a lot!

View 3 Replies View Related

SQL Server 2012 :: Input Parameter For Store Procedure Like In Statement Value 1 / Value 2

Jun 20, 2014

How can I input parameter for Store Procedure like In ('Value1','Value2')

Example :
Create procedure GetUsers
@Users nvarchar(200)
as
Select * from Users where UserID in (@Users)

View 6 Replies View Related

Problems With Remote SQL 2005 Server And Excel As An Input Source

Jan 5, 2006

Hello,

I am trying to write my first couple Integration Services packages using SQL 2005.  My configuration is a workstation running windows xp professional, and a windows 2003 server that is running the SQL server.

Anytime I run a package that accesses the remote server from my workstation, the job fails with an error code.  The workstation cannot seem to run a package to load data to the remote sql server.  Why is this?  Is there a service pack, or hotfix coming out soon to correct this problem?

Additionally, I also seem to be unable to update a database using excel as the data source from which information should be used.  If I import my excel spreadsheet into an access table, I can update the sql database from Access using integration services.  Why can't I use an excel spreadsheet as the source?  Is there a a service pack or hotfix coming out soon for 2005 sql that will correct this problem?

Thanks!

Jim

View 13 Replies View Related

Problem With Formula Input With SQL Server Management Studio Express

Aug 10, 2006

Hi all,

I'm creating a database using SQL Server Management Studio Express and have a problem. I've got 4 columns: Surface, Rent, MonthlyIncome and AnnualIncome. Surface and Rent are inputed by user, MonthlyIncome is straight calculation Rent*Surface using Computed Column Formula. But, when I want to calculate AnnualIncome SQL SMSE doesn't allow me to input formula like this MonthlyIncome*12. Where I can read about limitations in formula field?

TIA.

Przemek

View 3 Replies View Related

SQL Server Does Not Exist Or Access Denied After Input Of Critical Updates

Aug 3, 2006

Hello guys och dolls.

I have a DTS program in sql-server 2000 which worked to week 27 but not from week 28. During that time I was on vacation och no one else was working with the server.

The part which is the problem looks like this.

if exists (select * from dbo.sysobjects where id = object_id(N'[lenko7].[aviskydd]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [lenko7].[aviskydd]
GO

CREATE TABLE [lenko7].[aviskydd] (
[Col002] [varchar] (255) NOT NULL,
[linecount] [int] NOT NULL
) ON [PRIMARY]
GO

I have not changed owner.

I don't understand why this DTS package suddenly cant work because it has been working for a several years with no problems. The only thing a know is that we have updated windows 2000 cause of a critical updates Juli 13.

Is there anyone who has the same problem.

Regards Stig Holmlund

View 3 Replies View Related

SQL Server 2008 :: Save Data In Word Input File To Table

Jun 4, 2015

One people created a word input file (15 pages, including check boxes, text boxes, drop down lists...). Is it possible to save data in word input file to SQL table?

View 1 Replies View Related

SQL Server 2008 :: Stored Procedure Returning Different Datasets Based On Input Variable

Sep 15, 2015

I'm seeing where previous developers have used a single stored procedure for multiple reports, where each report required different columns to be returned. They are structured like this:

CREATE PROCEDURE dbo.GetSomeData (@rptType INT, @customerID INT)
AS
BEGIN
IF @rptType = 1
BEGIN
SELECT LastName, FirstName, MiddleInitial

[Code] ....

As you can see, the output depends on the given report type. I've personally never done this, but that's more because it's the way I learned as opposed to any hard facts to support it.

So what I'm looking for is basically 2-fold.

View 5 Replies View Related

SQL Server 2008 :: Search Each And Every String In Comma Delimited String Input (AND Condition)

Mar 10, 2015

I have a scenario where in I need to use a comma delimited string as input. And search the tables with each and every string in the comma delimited string.

Example:
DECLARE @StrInput NVARCHAR(2000) = '.NET,Java, Python'

SELECT * FROM TABLE WHERE titleName = '.NET' AND titleName='java' AND titleName = 'Python'

As shown in the example above I need to take the comma delimited string as input and search each individual string like in the select statement.

View 3 Replies View Related

SQL Server 2012 :: Table Returning Function With Input Table Name As Parameter

Nov 19, 2014

I'm using SS 2012.

I started with an inline table returning function with a hard coded input table name. This works fine, but my boss wants me to generalize the function, to give it in input table parameter. That's where I'm running into problems.

In one forum, someone suggested that an input parameter for a table is possible in 2012, and the example I saw used "sysname" as the parameter type. It didn't like that. I tried "table" for the parameter type. It didn't like that.

The other suggestion was to use dynamic sql, which I assume means I can no longer use an inline function.

This means switching to the multi-line function, which I will if I have to, but those are more tedious.

Any syntax for using the inline function to accomplish this, or am I stuck with multi-line?

A simple example of what I'm trying to do is below:

Create FUNCTION [CSH388102].[fnTest]
(
-- Add the parameters for the function here
@Source_Tbl sysname
)
RETURNS TABLE
AS
RETURN
(
select @Source_Tbl.yr from @Source_Tbl
)

Error I get is:

Msg 1087, Level 16, State 1, Procedure fnTest, Line 12
Must declare the table variable "@Source_Tbl".

If I use "table" as the parameter type, it gives me:

Msg 156, Level 15, State 1, Procedure fnTest, Line 4
Incorrect syntax near the keyword 'table'.
Msg 137, Level 15, State 2, Procedure fnTest, Line 12
Must declare the scalar variable "@Source_Tbl".

The input table can have several thousand rows.

View 9 Replies View Related

BCP Input

Jan 4, 2006

Using MSDE and OSQL
I begin with:

C:OSQL -D VID -i C:accepted.sql -o C:Resultsaccepted.txt -n -w500 -Usa

That gives me data such as this:

363 Cynthia KY 36
542 Charlene NC 3
594 Amanda NJ 9
592 Robert NJ 54

Then this command to create a table

CREATE TABLE accepted
(
Customer_idnvarchar(50)NULL,
Cust_Namenvarchar(50)NULL,
Cust_Statenvarchar(50)NULL,
Cust_Countnvarchar(50)NULL
)
GO

I've created this BCP format file:

8.0
4
1 SQLCHAR 0 50 "/t" 1 Customer_id SQL_Latin1_General_CP1_CI_AS
2 SQLCHAR 0 50 "/t" 2 Cust_Name SQL_Latin1_General_CP1_CI_AS
3 SQLCHAR 0 50 "/t" 3 Cust_State SQL_Latin1_General_CP1_CI_AS
4 SQLCHAR 0 50 "/r/n"4 Cust_Count SQL_Latin1_General_CP1_CI_AS


Table is created. I can SELECT * FROM accepted and see my column names.

Then I try to BCP into the table using:

C:>BCP sales..east in C:Resultsaccepted.txt -t -f C:cpformataccepted.fmt -Usa -Ppwd

I get this error:

Starting copy...
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation

and so on......

In the .fmt file I've tried "", " ", " " and everthing I could think of as a delimiter. Still no luck. I've tried almost every switch available to both OSQL and BCP.
The data I am trying to BCP is a SQL result so I don't think any special delimiters are placed. I've tried not using the .fmt file and using the prompts but still no luck. Data is CAST in the query and doesn't excede 45 characters.
Hope I've explained my problem well enough.

-Deana

View 11 Replies View Related

SQL Server Admin 2014 :: How To Position 5 Database Server For Centralized Database For Application

Jun 3, 2014

1) We are providing a e governance solution for an organization,where we are providing a centralized database,Client have provided 5 Database server for the same.how can we position the Database Server? there are 5000 Concurrent users and 25000 users,SAN Storage for approx. 60 TB,Database size of 2 TB and growth of 1 TB every year

2) How many instance can we have for above said Case?

3) How much RAM Required ?

View 0 Replies View Related

Input Chinese

Oct 5, 2006

Hi,I need to input Chinese character into the table of the database.  I did try to install/run both Chinese/English version of Visual Studio into Chinese/English version of Server 2003 but it still didn't work.Please help !stephen   

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved