unfortunately i have a table with a column named 'AS'. I want to insert data into this table using a stored procedure but i get the error that the syntax is wrong near to the 'AS' keyword.
I tried to build a query string and execute it with the EXEC command. But that doesn't help. Same error.
I have a field ID of type integer, I want to put two numbers in that field: 3 and 7, so what I do is just store the number 37.Now, is there a command in SQL server which checks if the ID field contains a number I look for, say 7.Something like a CONTAINS keyword...If there is, could someone please tell me what it is AND tell me a bit more about it :memory usage, (dis)advantages etc.
If the data type of field is "varchar",we can use "like" to query if it hassome substring.Such as "where custom.valuevariant like '%Verizon%' ", it will query out allrecords that contains string "Verizon".But how to do when data type of field custom.valuevariant is "image"?Thanks
I'm having Some Problem with my code....Whenever i try to insert from using a Insert button page gives me this error "System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Plan'." Can somebody help me What's the Problem...for your convenience i'm giving my code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then End If End Sub Sub doInsert(Source as Object, E as EventArgs) Dim myConn As SqlConnection = New SqlConnection(strConn)Dim MySQL as string = "Insert into Activities (ActDate, Activity, Plan, Completed) values (@ActDate, @Activity, @Plan, @Completed);" Dim Cmd as New SQLCommand(MySQL, MyConn) cmd.Parameters.Add(New SQLParameter("@ActDate", Textbox2.Text)) cmd.Parameters.Add(New SQLParameter("@Activity", Label5.TExt)) cmd.Parameters.Add(New SQLParameter("@Plan", Textbox3.text)) cmd.Parameters.Add(New SQLParameter("@Completed", Textbox4.text)) ' cmd.Parameters.Add(New SQLParameter("@Comments", Text11.text)) MyConn.Open() cmd.ExecuteNonQuery() BindData() MyConn.Close() label12.text = "Your data has been received!" ' else ' label12.text = "Data Already Enter For This Item-Name for This Date" ' end ifEnd Sub
I'm using DTS to import data from an Access memo field into a SQL Server ntext field. DTS is only importing the first 255 characters of the memo field and truncating the rest.I'd appreciate any insights into what may be causing this problem, and what I can do about it.Thanks in advance for any help!
We have a stock code table with a description field and a brand field - when the data was entered, some of the records were entered with the brand field in the description field.
ie. Code Description Brand ABC1 BLANK DVD SONY ABC2 SONY BLANK DVD SONY
what I need to do is identify where the Brand is in the Description field ...
Not a SQL guy but can do enough to be dangerous :)Trying to update a record. We have records that have a field with datasurrounded by some comment text such as *** Previous Public Solution*** Start and *** Previous Public Solution *** End . What I am tryingto do is write a SQL statement that will:Check that field C100 = TICKET0001 (to test with one record beforerunning on whole db)Check that field C101 is = ClosedCheck that field C102 is nullCopy field C103 data to field C102 and strip out any words such as ***Previous Public Solution *** Start and *** Previous Public Solution*** endThanks for any help!Kevin
Hi,This is driving me nuts, I have a table that stores notes regarding anoperation in an IMAGE data type field in MS SQL Server 2000.I can read and write no problem using Access using the StrConv function andI can Update the field correctly in T-SQL using:DECLARE @ptrval varbinary(16)SELECT @ptrval = TEXTPTR(BITS_data)FROM mytable_BINARY WHERE ID = 'RB215'WRITETEXT OPERATION_BINARY.BITS @ptrval 'My notes for this operation'However, I just can not seem to be able to convert back to text theinformation once it is stored using T-SQL.My selects keep returning bin data.How to do this! Thanks for your help.SD
What I am trying to create a query to check, If recDT is not value or null, then will use value from SELECT top 1 recDtim FROM Serv. Otherwise, will use the value from recDT. I have tried the below query but it doesn't work. The error says, Incorrect syntax near the keyword 'SELECT'.Incorrect syntax near the keyword 'else'.1 SELECT 2 case when recDT='' then SELECT top 1 recDtim FROM Serv else recDT end 3 FROM abc 4 Anyone can help? Thanks a lot.
I am attempting to create a stored procedure that will launch at report runtime to summarize data in a table into a table that will reflect period data using an array type field. I know how to execute one line but I am not sure how to run the script so that it not only summarizes the data below but also creates and drops the table.
I am trying to pass several ids to use in a where clause. 1 For Each row as GridViewRow In gv_child.Rows 2 If row.RowType = DataControlRowType.DataRow Then 3 Dim chk as CheckBox = CType(row.FindControl("cb_Approve"),CheckBox) 4 If chk IsNot Nothing AndAlso chk.Checked Then 5 Dim id As Integer = CInt(CType(row.FindControl("lbl_id"),Label).Text) 6 ids &= "," & id 7 End If 8 End If 9 If ids.Length > 1 Then ids = ids.Substring(1) 10 'Submit to sql with ids as param... 11 Next
I am getting an exception. Error converting '38,39' to a column of datatype int. What am I doing wrong?
In my SQL Server 2005 database I have created a table with several data fields. One of the fields is designated as a primary key. And another one is just a key. I can easily set the first field as the primary key, but am not able to set the second field as being just a key field. I perform these steps to set the primary key. (1) Right click on the table name and then select 'Open Table Definition' (2) I right click on the field in my data table and select 'Select Primary Key' As I mentioned previously, to set another field up as just a key field, I am not able to do this. My choices are the following when I right click on the data field to be designated as the key field: Set Primary Key, Insert Column, Delete Column,Relationships,Indexes/Keys,Full Text Index,XML Indexes, Check constraints,Properties. None of these choices will allow me to set the field up as a key field. Someone please help me out with this problem.
There has to be a better way (less code) to grab the data in one field than:string sql0 = "Select PSI from agentRate where agent='" + agent + "'"; SqlCommand command0 = new SqlCommand(sql0, conn2);SqlDataReader dr0 = command0.ExecuteReader(); string PSI="";while (dr0.Read()) {PSI = (string)dr0["PSI"]; } dr0.Close();
I recieved a SQL Server table that was supposed to have just the firstname in a field, but actually has firstname and middle name. Example David Michael Carol Anne Is there a way in a query to look for the blank space and separate the names?
I have a field in my table that is varchar:1500:null, but I cannot enter any more that 994 characters. any ideas why?
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Quotes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Quotes] GO
ALTER TABLE [dbo].[Quotes] ADD CONSTRAINT [DF_Quotes_Closed] DEFAULT ('N') FOR [Status] GO
CREATE INDEX [idx_RepID] ON [dbo].[Quotes]([RepID]) ON [PRIMARY] GO
CREATE INDEX [indx_CustomerID] ON [dbo].[Quotes]([CustomerID]) ON [PRIMARY] GO
CREATE INDEX [indx_QuoteID] ON [dbo].[Quotes]([QuoteID]) ON [PRIMARY] GO
CREATE INDEX [indx_Status] ON [dbo].[Quotes]([Status]) ON [PRIMARY] GO
[Comment] [varchar] (1500) NULL , is where I can't enter more than 994 characters.
note - I know very little about SQL, I just had the responsibility placed on me at my job. If this is not enough information to go on to throw an idea at me please let me know what else you need.
I got one prob and i need help to solve it. I got this one field in a table which contain a lot of datas and i need to sort it out into as many different data as a field for each. Example:
I am new here, and looking for some help with SQL import.
I am using SQL Server 2000.
Problem: I have a table called 'People', with a field that I wish to populate inside of it (Town). I already have 500 records in the table.
I have a seperate csv file containing the primary key record (ID) information, and the information that I wish to put into the field (Town).
How can I import the information into the field 'Town' by inserting the correct information next to the ID in the CSV file (There are some that I do not have to import, so I cannot just insert straight in).
Hi there, Need help.. I have a table name Changekitlist and have fields name CKNumber,ck_ID,ck_Name, etc.. Now, I plan to see each CKNumber one at a time so that I can put it in an array which I'll use in VB6 program.
However, If I use the command: "SELECT CKNumber from Changekitlist" it displays all the CKNumber list that I have (CK001 to CK500) and I cannot store it in an array properly because it display all CKNumber at once and store all the 500 CKNumbers at once in the array.
What will I do so I can display one CK Number at a time, store in an array and loop so that I'll get the next CKNumber and store it again.. Need your advice please. Thanks!
Are you able to take Case statments that have AS (Field name) and use those to subtract after one another under the data tabin sql?
For example i created 3 case statments and they have 3 columns
SUM(CASE WHEN action = 'b' AND glsrc IN ('RO', 'RR') THEN glamt ELSE 0000000.00 END) AS RentalBilling, SUM(CASE WHEN action = '6' THEN glamt ELSE 0000000.00 END) AS Depreciation, SUM(CASE WHEN action = 'a' THEN glamt ELSE 0000000.00 END) AS Repair
Under the data table I want to Subtract RentalBilling, Depreciation, and Repairs and then have that out come posted in a new column called totals.
Hi,how can i update the data in a field like that:organizationamesurenamezipcityI want to update the content from "organization"into "eworganization" followed by "amesurenamezipcity"yoursmarvin
I am in the process of importing data that is in a text format to thesql server, I want to add couple of fields and insert general data inthe fields added, this data is going to be similar to all the recordsimported. Your help in this regard will be greatly appreciated.
I am so frustrated, I don't know what to do. I have spoken to everyone that I know on how to explain this error message, but my supervisor wants to dispute every thing I tell him.
Could someone PLEASE explain the following error message and how I can go about finding what fields that it's talking about?
e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: There is no data for the field at position 15., ; Info: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: There is no data for the field at position 15.
I have two environments (2 seperate companies on seperate servers). In Environment #1 (referred to as Env1 from this point on) that runs the report and generates a few of these errors (10 for an example). In Environment #2, the same report only modified SLIGHTLY for the other company, runs the report and generates 50 errors. I'd be more than happy to post the log here if someone needs it.
Someone, please, save me from logfile hell. I have told this supervisor that "No data for the field" pretty much means that there was NO DATA RETURNED. We know for a FACT that these two environments are completely different. One runs on real servers and the other is running on partial real servers and virtual servers. We have identified several differences in the configurations, but he wants me to nail down EXACTLY what is causing this error. Please remember, "No Data" is not a good enough response for this person.
Please, for the love of all that is Chocolate, HELP!!!!!!!!!!!!!!!
Thanks in advance,
Jim Evans Microsoft Certified Application Developer