T-SQL (SS2K8) :: Update Table With Multi-line Comments?
Apr 14, 2014
How to update column with multiline comments.
eg. I need to update Notification column in my table as below.
Exit Formalities Notification sent to:
Employee: LastName, FirstName
EmployeeEmail: EmployeeEmailAddress
View 4 Replies
ADVERTISEMENT
Aug 31, 2007
I hope I'm posting this in the correct forum (forgive me if I'm not) since I'm not sure if this is an issue with inserting an item into a db or the processing of what I get out of it. I wrote a basic commenting system in which someone my post a comment about something written on the site. I wanted to keep it very simple, but I at least want the ability for a user to have newlines in their comment without having to hardcode a <br /> or something like that. Is there a way for me to detect a newline if someone, for example, is going to their next paragraph?
Let me know if you need a better explanation.
Thanks in advance!
View 4 Replies
View Related
May 26, 2004
Being an access guy, I am having a hard time understanding why I can't do a join statement on an UPDATE?
What is the alternatives??
I have to match two tables up and use records from one to update the other and creating a view isn't working....
View 5 Replies
View Related
Jul 23, 2005
I'm new to adp w/ sql server but I have to use it on a project i'mdoing...One of the MUSTS for this project is the ability to update a 00 - 09text value with the appropriate text description from another table...Easy as pie in .mdb. Of course In the stored procedure it barks at meand tells me that an update query can only have one table.. ouch thathurts...I'm currently reading on the subject but this group has been veryhelpful in the past.....I found this link...http://www.sqlservercentral.com/col...stheeasyway.aspUnfortunetly I'm using MSDE not Enterprise so I don't think I can usethe query analyser.. But I tryed it in my Access ADP anywayit barked at me..I tried to go from this....SELECT dbo.LU_SEX.SEX_CODE, dbo.TEST.DEFECTS_DP1FROM dbo.TEST INNER JOINdbo.LU_SEX ON dbo.TEST.SEX_DP1 =dbo.LU_SEX.SEX_DECTo this...UPDATE dbo.TEST.SEX_DP1SET dbo.TEST.SEX_DP1 = dbo.LU_SEX.SEX_CODEFROM dbo.LU_SEX INNER JOINdbo.TEST ON dbo.LU_SEX.SEX_DEC =dbo.TEST.SEX_DP1Maybe I need a good book on this?Thanks,Charles
View 2 Replies
View Related
Feb 4, 2008
the stored procedure don't delete all the records
need help
Code Snippet
DECLARE @empid varchar(500)
set @empid ='55329429,58830803,309128726,55696314'
DELETE FROM [Table_1]
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
TNX
View 2 Replies
View Related
May 6, 2015
DECLARE @id VARCHAR(10)
DECLARE myCursor CURSOR LOCAL FAST_FORWARD FOR
SELECT [ServersList] AS 'ID'
FROM dbo.Servers
[code]...
How do loop a table server(serverlist,flag) table with these 2 columns.And ping each of the servers in the table and update the flag column to '1' if ping has been successfull or flag to '0' if ping has been unsuccessfull.
View 1 Replies
View Related
Jul 8, 2014
I have to tables say 'employee1' and 'employee2'
employee1 has lastname
employee2 has firstname, lastname
i have to update firstname in employee1 from firstname in employee2 table and the common field for both tables is 'lastname'
View 8 Replies
View Related
Sep 28, 2004
Hi,
I have a Multiline Textbox in my application.The value from the textbox is updates in a SQL
table.The problem i have is
If I type in the textbox 1211 London street Sussex <br> UK <br>Europe ,only 1211 London street Sussex gets into the table.Anything I type after the "Enter " doesnot go into the table.
I checked the field sizes in my stored procedure and they are varchar(500) .
Any ideas
View 4 Replies
View Related
Aug 30, 2005
Is it not possible to have a multi-line annotation OR my ENTER key is stuck ;-)
View 7 Replies
View Related
Jul 10, 2006
Using Visual basic 2005
I have a form and set up my datasource, bindings etc.
All works well, adding, updating, and deleting via form to sqlexpress except.....
I have 2 columns set up in sqlserver that get data from muliline textboxes on my form.
Column 1 "Material" is nvarchar(50)
Column 2 "Quantity" is int
The first multine textbox "Material" works fine, eather updating in the textbox or in the Datagridview cell.
the second multiline textbox "Quantity" works when I just put in a number in the first line of the multiline textbox, when I put in the 2nd number on the second line, nothing gets updated.
I I do that in the datagridview cell (Shift-Enter), I get an error.
"System string was not in correct format".
I tried integer.parse, but that dosn't work. I'm assuming it has something to do with the next line ascii code or something like that.
Can anyone out there help with this
View 3 Replies
View Related
Mar 9, 2015
I have a table with hundreds of millions of records and need to update an xml column to null. I do something like this:
UPDATE [Mydb].[MySchema].[MyTable]
SET [XMLColumn] = null
Currently it is taking around 6 hours.
Is there a quicker way to do this?
View 1 Replies
View Related
Jul 29, 2015
I have a script that is supposed to run thru 2 joined tables and update a field in the 3rd table. The script works but takes approx. 4 hours to run against 250k records.
UPDATE a
SET Con_Mailings = STUFF((SELECT '; ' + c.ListName
FROM [server].[xxxxx_MSCRM].[dbo].ListBase c with (nowait)
INNER JOIN [server].[xxxxxx_MSCRM].[dbo].[ListMemberBase] b with (nowait)
ON b.ListID = c.ListID
WHERE b.EntityID = a.TmpContactID
FOR XML PATH('')),1,1,'')
FROM [xx_Temp].[dbo].[Lyris_CombinedTest] a
I should end up with something like this in the con_mailings field:
'Mailing1, Mailing2, Mailing3'
View 9 Replies
View Related
Feb 28, 2008
Hello,I'm a newbie and I have a little problem that's starting to work on my nerves I want to store a multi line textbox in the database, just like the way it has been entered.I used a varbinary-field.This is my code in my aspx Dim myOptions As New InterTyp.Opties() Dim myCon As SqlConnection = myOptions.getCon() Dim cmdOef As SqlCommand Dim parmOef As SqlParameter cmdOef = New SqlCommand("GetOef", myCon) cmdOef.CommandType = CommandType.StoredProcedure cmdOef.Parameters.Add("@oid", System.Data.SqlDbType.Int).Value = ID 'output parmOef = cmdOef.Parameters.Add("@otext", SqlDbType.VarChar) parmOef.Size = 8000 parmOef.Direction = ParameterDirection.Output 'execute the query myCon.Open() cmdOef.ExecuteNonQuery() txtOef.Text = cmdOef.Parameters("@otext").Value myCon.Close()In my code i call a sp:CREATE PROCEDURE dbo.GetOef @oid integer, @otext varchar OutputAS SELECT otext FROM oefening WHERE (oid = @oid) So my problem is:How do i cast the varbinary back to a text?
View 2 Replies
View Related
Apr 23, 2007
Good day,
Is there anyway that I can have a multi-line chart title? I have even tried placing a text box over the title part of the chart that is multi-line, although this appears to work once the report is deplyed and viewed in a web browser the text box appears below the chart and the chart then has no title.
Please can you help?
View 2 Replies
View Related
Jul 20, 2005
Hello,I'm trying to execute a file containing few SQL statements.CREATE VIEW test1 AS SELECT * FROM table1;CREATE VIEW test2 AS SELECT * FROM table2;The standard SQL way is to end a statement with semi-colon.But doing that,it doesn't work in SQL Server.After changing ";" to "GO", it works fine.Is there anyway we can stick to ";" to indicate the end of statement.I don't want to create scripts which works only in SQL Server.Please comment.Thanks in advance.
View 3 Replies
View Related
Jun 28, 2007
Hi everyone. I've taken a while off of developing site in ASP.net but had a site that I wanted to upgrade a little, but needed a little help.What I have currently is a website of a person with videos and images of that person. To view the videos, I have a "view_video.aspx?ID=" page that plays the video from YouTube by looking my database for the ID, YouTube URL, Name, and Description. What I want to do is create a "comments" table for visitors to add comments for each video and then display all comments on the page.So far, my "comments" table looks like this. ID, otherID, name, email, comment, type, date.The ID is the id of the comment, otherID is the foreign key to the "videos" table, the name is the name of the person leaving the comment, e-mail is for the person, comment is the text, type is the type of video (tutorial, sampler, random video), and date is a timestamp for when users leave the comment.So hopefully I have a good start. I don't have any code to show right at the moment for I am at work, but if anyone has any ideas or critiques so far, I'd love to hear them. This is an interesting project for my friend and I'd love to implement this sometime.Thanks,TetrisSmalls
View 1 Replies
View Related
Mar 10, 2004
I am working on a project that lets visitors to my webpage post comments. I have there name, city, etc. stored into an sql database. This all works until I put text into the comments field of my form. I get this message when it is trying execute -- String or binary data would be truncated. I was wondering what data type to use, I have used char and varchar and neither one is working. Is there anything else I could try to fix this.
View 1 Replies
View Related
Jun 4, 2002
Has anyone discovered how to store table and column comments inside SQL Server 2000? It was supposed to be an added feature with 2000.
thanks!
View 1 Replies
View Related
Sep 7, 2006
Hi chaps,
I have the following SQL query (SQL 2005).
Its basically retrieving some values using simple joins.
However there appears to be a problem with the LEFT OUTER JOIN:
"LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
"
When I try to compile the code i Get :
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "OrderLineItemTransaction.OrderLineItemTransactionI D" could not be bound.
Any help would be appreciated.
Cheers
Bal
SELECT
ord.orderDate,
cc.forename + ' ' + cc.surname person,
prod.description,
oli.noofitems,
deladdr.housenameno + ' ' + deladdr.addressLine1 + ' ' + deladdr.addressLine2 + ' ' + deladdr.city + ' ' + deladdr.postcode + ' ' + deladdr.county + ' ' + deladdr.country deladdress
FROM
product prod,
OrderLineItem oli,
[Order] ord,
OrderTransaction ordT,
OrderLineItemTransaction oliT,
CustomerContact cc,
Customer cust,
DDDispatchedOrder dd,
address deladdr,
address invaddr
LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
WHERE
prod.productID = oli.productID:eek:
AND ord.orderID = oli.orderID
AND ord.orderID = ordT.orderID
AND oliT.orderlineitemID = oli.orderlineitemID
AND cc.customercontactID = ord.customercontactID
AND cc.customerID = cust.customerID
AND ord.invoiceaddressID = invaddr.addressID
AND ord.deliveryaddressID = deladdr.addressID
AND ordT.dispatchTypeID = 2
View 7 Replies
View Related
Jul 13, 2004
Is there a way to add comments on a table in sql server?
View 14 Replies
View Related
Nov 9, 2005
I have a table with almost a million rows, although it's quite slim with just ID, date, userID, JobID etc.
Now I want to the ability to add comments to some (probably less than 1%) of those lines.
The question is whether to create a separate comments table to join to it, or to create a comments field within the existing table? The comments field would obviously default to NULL, so wouldn't bloat the table unnecessarily if I add that field (right?), and would always be selected with the row from that table, so I'm leaning towards the latter alternative.
Any thoughts, words of warning?
Thanks
Mark
View 17 Replies
View Related
May 27, 2008
hi need help how to send an email from database mail on row update
from stored PROCEDURE multi update
but i need to send a personal email evry employee get an email on row update
like send one after one email
i use FUNCTION i get on this forum to use split from multi update
how to loop for evry update send an single eamil to evry employee ID send one email
i update like this
Code Snippet
:
DECLARE @id nvarchar(1000)
set @id= '16703, 16704, 16757, 16924, 17041, 17077, 17084, 17103, 17129, 17134, 17186, 17190, 17203, 17205, 17289, 17294, 17295, 17296, 17309, 17316, 17317, 17322, 17325, 17337, 17338, 17339, 17348, 17349, 17350, 17357, 17360, 17361, 17362, 17366, 17367, 17370, 17372, 17373, 17374, 17377, 17380, 17382, 17383, 17385, 17386, 17391, 17392, 17393, 17394, 17395, 17396, 17397, 17398, 17400, 17401, 17402, 17407, 17408, 17409, 17410, 17411, 17412, 17413, 17414, 17415, 17417, 17418, 17419, 17420, 17422, 17423, 17424, 17425, 17426, 17427, 17428, 17430, 17431, 17432, 17442, 17443, 17444, 17447, 17448, 17449, 17450, 17451'
UPDATE s SET fld5 = 2
FROM Snha s
JOIN dbo.udf_SplitList(@id, ',') split
ON split.value = s.na
WHERE fld5 = 3
now
how to send an EMAIL for evry ROW update but "personal email" to the employee
Code Snippet
DECLARE @xml NVARCHAR(MAX)DECLARE @body NVARCHAR(MAX)
SET @xml =CAST(( SELECT
FirstName AS 'td','',
LastName AS 'td','' ,
SET @body = @body + @xml +'</table></body></html>'
EXEC msdb.dbo.sp_send_dbmail
@recipients =''
@copy_recipients='www@iec.com',
@body = @body,
@body_format ='HTML',
@subject ='test',
@profile_name ='bob'
END
ELSE
print 'no email today'
TNX
View 2 Replies
View Related
May 19, 2014
I am working with a large amount of text data in a single column. I am in the process of pumping that column of data into a delimited text file. The data in the column has new line characters that I need to remove. I need to data to be in a single line in the text file.
So far the things that I have tried are not working. What I try for removing the new line characters?
View 3 Replies
View Related
Nov 9, 2007
It appears to update only the first qualifying row. The trace shows a row count of one when there are multiple qualifying rows in the table. This problem does not exist in JDBC 2000.
View 5 Replies
View Related
Jun 12, 2015
I have 2 tables ... order table (shipping city and destination city) and a referential city table:
1:New York
2:Chicago
3:Atlanta
etc...
In the order table the shipping address and destination address have the identity's a values, I want to write a join to show the names of the cities instead. I'm doing something like this, is there a way to do it in one select?
;with srcemkt as
(
select ID, OrderNumber, b.MarketCenterCity as 'SourceMKT',
from Orders as a
join MarketCity as b
[Code] .....
View 6 Replies
View Related
Aug 4, 2015
I have a table which has been import from a TXT file. Most lines can be ignored, but when I get a line like this
'qwwwwwww 399 0 75124M - 2015-02-06 13:07:29'
I need to insert into a table as 6 columns ('-' is a value)
View 7 Replies
View Related
Mar 13, 2014
I am using the following code in my query to fetch data for my ssrs report which have a parameter @auditCode, where multiple auditCodes can be inputted to generate the report.
Is there any other way I can achieve the same functionality avoiding the part charindex(LU.auditCode,@auditCode)<>0 , as it will return wrong results.
For instance, it will return, the results for the audit code ‘INPS45’ and ‘INPS450000’ when audit code ‘INPS45’ is inputted.
SELECT distinct Ac.activityCode,
Ac.ActivityName + isnull(Ac.description,'') AS ActivityName,
Ac.activityStartDate, Ac.activityEndDate,
LU.auditCode,
LU.AuditName,
St.studyCode AS StudyCode,
St.StudyName AS StudyName
[Code] ....
View 3 Replies
View Related
Jan 25, 2012
I have a detail table of comments. I need to grab the fist 50 characters from the comment field from this table. The kick is that I need to get the comments from all of the records in the detail table, as the comments might be less than 50 characters, so i need to pull the comments from the other comment records that apply to the master table record.
right now i have the comments in a join to the master table, but this is causing a few records to be returned....
I guess what i am looking for is a way to grab the comment value from the first record of the detail table.
View 1 Replies
View Related
Aug 26, 2014
I am working with a table that has a column which stores multiple data/values that are comma separated.
I need to be able to query that table and get those rows where the values in that column match a pre-defined search list.
I was thinking of somehow trying to take the search list and convert it to a table(temp or a cte) and then JOIN to the table.
however, since the column may contain multiple values, i would need to parse/separate that first. I am not sure how to parse and then join to a list (if that is even the best way to solve this) to only get the rows where the search column contains one or more of the items we're looking for.
Below is some sample data:
Declare @BaseTable table (PKCol int, Column2Search varchar(2000))
Insert into @BaseTable (PKCol, Column2Search)
Select 1001, 'apple,orange,grapefruit'
UNION ALL
Select 1002, 'grapefruit,coconut'
UNION ALL
[Code] ....
View 8 Replies
View Related
Jan 29, 2015
This query is the first time I am using the Unpivot syntax and I am coming across a problem. When I try to unpivot my data, I get the following statement:
"Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "Table3.DocketId" could not be bound."
What is the cause of this issue?
Select
Table3.DocketId,
UP.AssignmentType,
Up.AssignedStaff
From
(
Select distinct
Table2.DocketId,
[Code] ....
View 3 Replies
View Related
Apr 30, 2015
table2 is intially populated (basically this will serve as historical table for view); temptable and table2 will are similar except that table2 has two extra columns which are insertdt and updatedt
process:
1. get data from an existing view and insert in temptable
2. truncate/delete contents of table1
3. insert data in table1 by comparing temptable vs table2 (values that exists in temptable but not in table2 will be inserted)
4. insert data in table2 which are not yet present (comparing ID in t2 and temptable)
5. UPDATE table2 whose field/column VALUE is not equal with temptable. (meaning UNMATCHED VALUE)
* for #5 if a value from table2 (historical table) has changed compared to temptable (new result of view) this must be updated as well as the updateddt field value.
View 2 Replies
View Related
Oct 21, 2015
I have to count the number of instances of each word in the Comments column throughout the table using SQL Server. Eg:
Row# Comments
1 I like working on SQL
2 I enjoy sleeping and like watching TV
So the output should be :
Word Count
I 2
like 2
working 1
on 1
SQL 1
.......
Any way to get this count using MS SQL?
View 5 Replies
View Related
Apr 8, 2014
Table:
CREATE TABLE [dbo].[KPI](
[SVP] [varchar](20) NULL,
[Wk1] [int] NULL,
[Wk2] [int] NULL,
[Wk3] [int] NULL,
[Wk4] [int] NULL,
[Wk5] [int] NULL,
[Y] [int] NULL,
[Q] [int] NULL,
[Wk] [int] NULL
)
To generate sample data:
insert into KPI (SVP, Wk1, Wk2, Wk3, Wk4, Wk5, Y, Q, Wk) Values ('SVP', 1,0,0,0,0,2014,1,1)
insert into KPI (SVP, Wk1, Wk2, Wk3, Wk4, Wk5, Y, Q, Wk) Values ('SVP', 0,2,0,0,0,2014,1,2)
insert into KPI (SVP, Wk1, Wk2, Wk3, Wk4, Wk5, Y, Q, Wk) Values ('SVP', 0,0,3,0,0,2014,1,3)
insert into KPI (SVP, Wk1, Wk2, Wk3, Wk4, Wk5, Y, Q, Wk) Values ('SVP', 0,0,0,4,0,2014,1,4)
insert into KPI (SVP, Wk1, Wk2, Wk3, Wk4, Wk5, Y, Q, Wk) Values ('SVP', 0,0,0,0,0,2014,1,5)
[Code] ....
Current result:
SVPWk1Wk2Wk3Wk4Wk5YQWk
SVP10000201411
SVP02000201412
SVP00300201413
SVP00040201414
[Code] ....
Expected result:
SVPWk1Wk2Wk3Wk4Wk5YQ
SVP1234020141
SVP30 1 2 6 9 20142
SVP103226820143
SVP17233141120144
I surely can loop each row and insert the needed value into the result, I want to know if there is a better way to generate the result.
View 2 Replies
View Related