Hi to all.Many times i saw that some people wrap the single insert, delete or updatestatements to transaction.My question is suppose i have procedure , and inside this procedure i performupdate i exatly know that only one row will be updated , is necessary or wheni need to wrap it with transaction------------------------------------------------------------------------------CREATE PROCEDURE Test_sp@ID intasUPDATE MyTableSET col1 = 'bla bla'WHERE [ID] = @ID-------------------------------------------------------------------------------in code above only on row will be updated so why some times i see :------------------------------------------------------------------------------CREATE PROCEDURE Test_sp@ID intasBEGIN TRANUPDATE MyTableSET col1 = 'bla bla'WHERE [ID] = @IDSELECT@rowcount = @@ROWCOUNT,@error = @@ERRORIF @error = 0 AND @rowcount =1GOTO SUCS_STEPELSEROLLBACK TRANSACTION TRC_EVENTGOTO ERROR_STEPENDERROR_STEP:RETURN 0SUCS_STEP:COMMIT TRANSACTION TRC_EVENTRETURN 1GO-------------------------------------------------------------------------------The update statement is itself in transaction so why there are need to wrapto tranasction.So PLZ explain in wich cases i need to wrap (INSERT, UPDATE, DELETE)statements intotransactions????ONLY when i perform a single statement i.e one insert or one delete or oneupdate !!!!TNX.--"Imagination is more important than knolwege" (Albert Einshtein)Message posted via SQLMonster.comhttp://www.sqlmonster.com/Uwe/Forum...eneral/200508/1
I am using visual studio reporting services to create some overviews. Several of my columns contain data which are extremely long, but it is shown as wrapped text which makes that my cells are becoming really big. Is there an option in Visual Studio to unwrap this text (like you can do in Excel)?
Is there a way to distribute merge and transactional replication commands/files such that a slight hiccup in the connection does not cause replication to fail? Maybe like wrapping them in a zip or other type of file?
A string needs to be stored in a SQL 2000 table varchar(255) fileld in such a way that when emailed or printed out, it will display as below: Name: John DoePhone: 213-444-5555Email:jdoe@test.comCity: New YorkCountry: USA How can such a string be constituted?Thanks
Hi all,I want to create a c# method that wrap a sql stored procedure and is mantained updated in c#.Ex: Stored Procedure on db:insTableA(par varchar(255)....I want to create a class in c# like this:public class insTableA { public object Execute(String par) { // call execution of stored insTableA ................ } } Using VS 2005 e Sql Server 2005you know a method to do this and to mantain (automatically!) the c# class update when I change the stored procedure signature (ex: if change the number or datatype of parameters)??? Thanks....Luca
Hi all,I'm a newbie to SQL and I need help with investigating what ways arepossible to build an interface of some sort that wraps around a SQLquery script.I have a simple SQL query which we normally run inside Query Analyzerto update certain fields in the SQL DB based on FQDN provide by theuser. The user normally opens up the query, edit the script to replaythe xxxxx in the line "set @FQDN="xxxxx" with the node name and thenfires it off.I would like to know what are the ways to wrap a simple user interfacearound it so the user does not have to open and edit the scriptdirectly. A simple GUI or Excel type form interface that has a freeform text field for input and then a button to run the script.Obviously, I would like to see the output in some sort of output paneas well.Is this something that can be done in Query Analyzer ?Thanks in advance,Michael.
We had finished converting a lot of our reports from Crystal Reports to SSRS. Upon doing so, one report, the customer's invoice has comments in the report that contain (s) at then end of a word to indicate singular or plural. Crystal reports handled the wrap correctly and kept the word together including the (s), but in SSRS, the (s) is being wrapped to the next line, which doesn't look good at all.
what i need is very simple ...i just want to show very long strings in sql reporting services report but i can't find any way to wrap up the very long text in the text box of a matrix ..i mean there is no property says word wrap or text wrap in sql reprting service..there are can grow and can shrink properties but these is not what i want....when i set it as can grow false then user has no way to read the rest of the text , there is no preview when i set false 'can grow' propety.. basically what i want is , users are able to read the rest of the text when they move the mouse over the text and can grow should be false , so column will not take any space... please help !
i am creating/uploading a new file on the webserver, and if it is successfully i want to insert a record in the database (with the filename).is there a way to create a transaction for this so that if either operation fails they both fail?
We are experiencing problems with reporting services built-in Export to Excel. Basically, the columns get wrapped in Excel, which frustrates users who need to pivot and sort(ie the point of downloading to Excel). Is there a method for removing the column wrapping? Please help
Because of a limitation on a piece of software I'm using I need to take a large varchar field and force a carriage return/linebreak in the returned sql. Allowing for a line size of approximately 50 characters, I thought the approach would be to first find the 'spaces' in the data, so as to not split the line on a real word. achieve.
--===== Simulate a passed parameter DECLARE @Parameter VARCHAR(8000) SET @Parameter = (select a_notes from dbo.notestuff as notes where a_id = '1')
I have just started using SQL Server reporting services and am stuck with creating subreports.
I have a added a sub report to the main report. When I right click on the sub report, go to properties -> Parameters, and click on the dropdown for Parameter Value, I see all Sum and Count fields but not the data fields.
For example, In the dropdownlist for the Parameter value, I see Sum(Fields!TASK_ID.Value, "AppTest"), Count(Fields!TASK_NAME.Value, "CammpTest") but not Fields!TASK_NAME.Value, Fields!TASK_ID.Value which are the fields retrieved from the dataset assigned to the subreport.
When I manually change the parameter value to Fields!TASK_ID.Value, and try to preview the report, I get Error: Subreport could not be shown. I have no idea what the underlying issue is but am guessing that it's because the field - Fields!TASK_ID.Value is not in the dropdown but am trying to link the main report and sub report with this field.
Am I missing something here? Any help is appreciated.
How can I create a Table whose one field will be 'tableid INT IDENTITY(1,1)' and other fields will be the fields from the table "ashu". can this be possible in SQL Server without explicitly writing the"ashu" table's fields name.
I've got some SQL that works as far as returning a recordset from a series ofUNION statements.viz:SELECT whateverUNION thisUNION thatUNION otherNow I want to group and sum on it's results.Started out tying:SELECT * FROM(union stuff)....but couldn't even get past the syntax check.Where I'm headed is a sort of pivot table presentation of some hours dataassociated with various projects with a column for each of six date ranges.Bottom line: can somebody give me a pointer to the syntax needed to wrap thoseUNION statements and then select/group/sum their results?--PeteCresswell
Hello !I'm trying to update one table field with another table searched firstdate record.getting some problem.If anyone have experience similar thing or have any idea about it,please guide.Sample case is given below.Thanks in adv.T.S.Negi--Sample caseDROP TABLE TEST1DROP TABLE TEST2CREATE TABLE TEST1(CUST_CD VARCHAR(10),BOOKING_DATE DATETIME,BOOKPHONE_NO VARCHAR(10))CREATE TABLE TEST2(CUST_CD VARCHAR(10),ENTRY_DATE DATETIME,FIRSTPHONE_NO VARCHAR(10))DELETE FROM TEST1INSERT INTO TEST1 VALUES('C1',GETDATE()+5,'11111111')INSERT INTO TEST1 VALUES('C1',GETDATE()+10,'22222222')INSERT INTO TEST1 VALUES('C1',GETDATE()+15,'44444444')INSERT INTO TEST1 VALUES('C1',GETDATE()+16,'33333333')DELETE FROM TEST2INSERT INTO TEST2 VALUES('C1',GETDATE(),'')INSERT INTO TEST2 VALUES('C1',GETDATE()+2,'')INSERT INTO TEST2 VALUES('C1',GETDATE()+11,'')INSERT INTO TEST2 VALUES('C1',GETDATE()+12,'')--SELECT * FROM TEST1--SELECT * FROM TEST2/*Sample dataTEST1CUST_CD BOOKING_DATE BOOKPHONE_NOC12005-04-08 21:46:47.78011111111C12005-04-13 21:46:47.78022222222C12005-04-18 21:46:47.78044444444C12005-04-19 21:46:47.78033333333TEST2CUST_CD ENTRY_DATE FIRSTPHONE_NOC12005-04-03 21:46:47.800C12005-04-05 21:46:47.800C12005-04-14 21:46:47.800C12005-04-15 21:46:47.800DESIRED RESULTCUST_CD ENTRY_DATE FIRSTPHONE_NOC12005-04-03 21:46:47.80011111111C12005-04-05 21:46:47.80011111111C12005-04-14 21:46:47.80044444444C12005-04-15 21:46:47.80044444444*/
I am using MS SQL 2012. I have a table that contains all the data that I need, but I need to summarize the data and also add up decimal fields while at it. Then I need a total of those added decimal fields. My data is like this:
I have Providers, a unique ID that Providers will have multiples of, and then decimal fields. Here are my fields:
I would like to search a table for a phrase, or for a partial phrase,eg on table product - for name or description, or name + descprition.How does one say select * from product where name + description like%phrase%or contains phraseCurrently I can get where name, or where descriotion like %phrase%,eg, where name like krups, or where description like coffee makerBut if I search for where name like %krups coffee maker% i get noresults. krups is in the name field, coffee maker is in thedescription field.Thanks,-M
Pardon me if this question is too elementary. I am trying to create a trigger that will cause certain datafields to be updated with values from other data fields in the same row when a certain column, created specifically to fire the trigger, is updated. The purpose of this is to reduce data entry by field personnel.I think I have the create trigger statement correct, but I'm a little confused on the update statement.
In a nutshell, how can I write something like: UPDATE "TABLENAME" SET DATAFIELD1 = DATAFIELD2 WHERE RECORDNUMBER = (THE SAME RECORD NUMBER)
I do know that I have to ensure that sp_dboption Recursive Triggers value is set to false, thanks.
I have a list of items in one table and a field (pageName) in another table that may contain one of the aforementioned items somewhere within that field. There is no fixed position within the field where the itemNo may be so I can't just use SUBSTRING(pageName,2,5) in(select itemNo from tblItem).
Logically, it's like I need to combine IN and LIKE: select pageName where pageName LIKE IN %select itemNo from tblitemNo%..LIKE can only handle one comparison string.
Hi people My users are having troubles with link to default drillthrough report when reports are exported to excel (they REALLY don't like this behavior ), so I decided set all of them disabled in report model, this work fine, but calculated field in reports has this drillthrough link.
Let me show you the situation. Entity Product has an UnitaryCost field, I set the EnableDrillthrough Property in False so when I export a report with this field, no link is shown.
But if I create in the report a calculated field Round(UnitaryCost) this field has a Drillthrough Link
Is this the standard and expected behavior? or its simply a BUG?
Have I done something wrong in my model? and in this case, How I can correct this?
Hi! I used MS Access database! I need to know what are the replications of MS Access fields in MS SQL Server?! 1) What is TEXT field of MS Access in MS SQL Server?! 2) What is MEMO field of MS Access in MS SQL Server?! 3) How to set AutoNumber in MS SQL Server?! I get confused because my online web based sql admin of my host had many options like varchar... 3) Please tell me the size of the fields too as i will be storing a large amount of data! 4) In MS Access there was field size like...60...! But in MS SQL Server there was 16 written next to the TEXT field! What is it? some Bytes?! Thanks!
So, I want to create a view which will summarise total points given i.e. sum of feature1 -feature5. How do I do this? Do I need a function or is there a built-in function? All I can find is info on aggregate functions... but I want it per row...
Edit: the question is more clear in http://www.dbforums.com/showthread.php?p=4477661&posted=1#post4477661
OK this question is not really SQL server related but since we will build the database in MS SQL Server (2000) i think this is the proper forum to ask this question.
It's actually a quite simple question i gues, but my experience with databases is very limited (buiding my first serious database actually).
when i have two tables Organization and Samples coming from this organization with the following fields:
Organization:
InstituteID (identification) Name Adress ...
Sample:
SampleID (sample identification) InstituteID (references to the Institute table) SampleDate Location ...
In general is it better to use the sampleID and InstituteID combined as primary key in the second (sample) table (and build an index on the combined key) or to generate a new unique key for each record? And why should i choose either one of these options?
One advantage of the first option is you dont have to generate keys yourself (or use some autonumbering system), however the disadvantage is the key grows bigger and bigger when adding more tables (fraction taken from samples, analysis performed on fractions, Analysis giving results).
Hi AllI need some help.I have a table with 2 fields (Nights and year) that looks like this:Nights, Year1, 20042, 200444, 200545, 2005Now I want to make an sql query that returns a sum of each year like this:field 2004,2005Data 3, 89How can I make this work?SincerelyDiedrik
Hi,Is there a way in SQL Server, or Access to determine what fields arebeing used in reports or joins, etc?Scenario:Field A in Table 1 is going to be either deleted or change data types,and I'd like to know what impact that will have.Yes...No?Thanks,Bodi