I want to save xml string in sql, but, i have problem, the length of the string is 19,000 - 24000 chars, and nVarChar can contain 4000 chars, and binary can contain 8000 chars...
Hello:I didn't find any documentation that notes save point names are casesensitive, but I guess they are...Stored Proc to reproduce:/* START CODE SNIPPET */If Exists (Select * From sysobjects Where Type = 'P' and Name ='TestSaveTran')Drop Procedure dbo.TestSaveTranGoCreate Procedure dbo.TestSaveTranAsBeginDeclare@tranCount int--Transaction HandlingSelect @tranCount = @@TRANCOUNTIf (@tranCount=0)Begin Tran localtranElseSave Tran localtranBegin Try--Simulate Error While ProcessingRAISERROR('Something bad happened', 16, 1)/*If this proc started transaction then commit it,otherwise return and let caller handle transaction*/IF (@tranCount=0)Commit Tran localtranEnd TryBegin Catch--Rollback to save pointRollback Tran LOCALTRAN --<< NOTE case change--Log Error--Reraise ErrorEnd CatchEndGo--Execute Stored ProcExec dbo.TestSaveTran/*Should receive the following message:Cannot roll back LOCALTRAN. No transaction or savepoint of that namewas found.*//* END CODE SNIPPET */What is really strange, if there is a transaction open, then no erroris thrown. So if you execute as so:/* START CODE SNIPPET */Begin Tran--Execute Stored ProcExec dbo.TestSaveTran/* END CODE SNIPPET */There is no "Cannot roll back LOCALTRAN...." message.Questions:1-)Can someone confirm save point names are case sensitve and this isnot happening because of a server setting?2-)Is this a logic error that I am not seeing in the example codeabove?We have changed our code to store the save point name in a variable,which will hopefully mitigate this "problem".Thx.
I am new to sql sever management studio express, but a long time query analyzer user. This is a very basic question.
I want to change the default directory in sql server management studio express so that when I go to save a query, it is already pointed to the correct one. Where do I change that?
Hello,I created a class in my .Net code and I have an SQL 2005 table with a column of type image (I suppose I should use this type)After I define the class properties I need create a new record and save the class in the database.Can I do it the same way as I would save, for example, a string in a varchar field?Thanks,Miguel
I'm just wondering if we can save sql aggregate functions into a variable. I have this query:select company, dept, sum(pers) as pers1, sum(amount) as amount1,sum(amount)/sum(pers) as wage from xxtestsumgroup by company, dept instead of calling sum(amount) and sum(pers) again in "sum(amount)/sum(pers) as wage",I would like to save them in some kinda variable in the select clause so it will save process time.Sorry but im new to sql programming. So thx for your understanding.
I am writing VBA code to save a PDF document to a SQL 2005 database table. Does anyone have any tips on how to do this? I assume the data type in the database will be varbinary(max)??
In Enterprise Manager when I bring up Trigger Properties there is an active button titled "Save as Template". But when I switch to an existing trigger the button is disabled. Oddly, the Help file for the dialog box doesn't even mention this button.
Anybody know what this does, how it works, or why it would be usefull? Any references to The Holy Book would be helpfull.
i have a vb6 app that writes data to a msde 7 db (in batches). when i run the process inhouse the entire process takes just under 2.30 min to save a batch of 50 records. when i run the process onsite it takes about 20 to 25 min to save the exact same batch. both enviroments are are set up the same (both have win xp and the db it is writing to is local). i took a copy of my onsite db and ran it inhouse and the results were fine (2.30 min to save the batch of 50). this process was running fine onsite up until a month and a half ago. does any one know what might of caused this issue (virus, xp updates, db curput). or does any one have any ideas on what i can try to resolve this issue.
i have made a windows applicatioon and connect to a database but when i enter the data and presss the button then it did not save the data in database so what should i do ,here i m writing the whole code and please help me and solve this problem private void button1_Click(object sender, EventArgs e) {
SqlConnection CON = new SqlConnection(@"Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database1.mdf;Integrated Security=True;User Instance=True");
Hai, Im using Sql server 2000. Im writing appliction to do Batch Update, meaning updating more than one row in single database call.. In my Requirment i may get around 2000 record to update... so i want to us Savepoint after every 200 records are updated to the database.. Can i use save point for my requirment...can someone clarify
Hi , i want to save a employee image in my database. I have chosen field type as varbinary. Now is there any way to save image directly (like other data e.g text,no) into table column using Enterprise Manager ?????
A friend of my self asked me how he can save a password not as clear text. He wanted to encrypt the password and save the encrypted string in the database.
How can he do this. I heard from somebody that he might do this with SSIS. Unfortunately I doesn't understand what he ment. Maybe somebody can help me here.
Ok, I have a solution for this but it involves a cursor that will take 3 days to run. Please someone save me from this!
I have a table that contains 700,000 records. I need to update a field in this table with an integer to denote what set of records it belongs to. Basically if you look at the table in order by RowID, everytime the AcctNUM changes, the fieldtofill is incremented. The AcctNum will show up multiple times throughout the table.
Its a long story but the file we started with was junk and this is the only way out.
Right now I have a cursor that is steping through, checking the value of the last row, if its the same it gets that same number, if its different it increments the number and updates the row.
Its been running over two hours and only 25,000 or so records have been updated.
Is the cursor my only way out? I wish I had optimized the cursor a bit, as it making it a fast_forward or something. Would that shave off more time than the two and half hours already invested?
i'm trying to save data to an XML file from an OLE DB source using the "For XML" clause in the SQL command. Do I need to use a flat file connection manager or a raw file connection manager? And what destination do I use?
I haven't downloaded nor installed it but I have some general questions about it:
*Can I store a SQL Server-Express Database as a file, so that the Users can easily back it up or use my application as a portable one *Do the enduser have to install SQL Server Express or any addition when I'm programming for the .Net Framework 3.5?
The XML generated by notifications object needs to be saved. Where do I save it - in the database. That will still be stored in a table - with drawbacks!
Using ASP.net I need to be able to save and retrieve PDF Files in SQL.I believe the best way to do this is through a BLOB datatype.I have been searching (without luck) for a tutorial/code sample explaining how to do this.Any help would be greatly appreciated.Chrisp.s. I know many prefer to store the files on the server and simply store pointers to the files in SQL, but I need to store the actual files in SQL.
i have an xml file, it looks like this: <?xml version="1.0" encoding="ISO-8859-1"?><shiporder orderid="889923" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shiporder.xsd"> <orderperson>John Smith</orderperson> <shipto> <name>Ola Nordmann</name> <address>Langgt 23</address> <city>4000 Stavanger</city> <country>Norway</country> </shipto> <item> <title>My Title</title> <quantity>1</quantity> <price>10.12</price> </item> <item> <title>Hide your heart</title> <quantity>1</quantity> <price>9.90</price> </item></shiporder> how can i save this into a database(Sql) using a procedure or..there is another way to do this? im a newbie
how do you store a datareader propety to a variable? Below is my current code. I have already declared my connectionString and sqlComm objects, as well as the userName and such. I need to store the value from the dr to the variables, UserName, UserPass, and serverName. ThanksTry sqlCon.Open() dr = sqlComm.ExecuteReader While dr.Read userName = dr("uName").ToString LogInfo("userName = " & userName)
Hi All, I have a database table with a bit field. In my .aspx page I have a checkbox that is checked by default. My SqlDataSource is set up like so: InsertCommand="INSERT INTO Studies (Study_Name, Study_Status) VALUES (@StudyName, @StudyStatus)"> <InsertParameters> <asp:ControlParameter ControlID="txtStudyName" Name="StudyName" PropertyName="Text" Type="String"/> <asp:ControlParameter ControlID="chkboxStudyStatus" Name="StudyStatus" PropertyName="Text" Type="Boolean"/> I'm getting an error when inserting. Error: Cannot insert the value NULL into column 'Study_Status', table 'Studies'; column does not allow nulls. INSERT fails. The statement has been terminated.
I am trying to create a website that people can upload an image and have it saved to a database. Can someone point me in the right direction on this? What properties need to be saved in the db and how?
Hi, i have a table called fundperformance and i opened that table in design view and deleted a column and added another column to that table and when i try to save the changes i made to it i get the below error. 'Fund' table saved successfully'FundPerformance' table- Unable to create index 'PK_FundPerformance'. The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.FundPerformance' and the index name 'PK_FundPerformance'. The duplicate key value is (1).Could not create constraint. See previous errors.The statement has been terminated. what should i do to fix it. Thanks Karen
I have the need to allow a user to upload a file via the web and then save it into a database. THen I also need to be able to retrieve the file for download.
Can someone give me guidance as to code or a sample on how to do this.
When I am trying to save byte[] of an image to SQL server which is having an image column, I am getting an error like this " A severe error occured on the current command. The results, if any, should be discarded.". I am trying to save through a stored procedure. In the sp also, the datatype is image.
I have a asp.net application where i can choose to save any file(could be jpg or dat or txt or xml etc etc) into a table.So far,i've manage to save it into an SQL server table in a column(set to Image datatype).But when i get the data from the table,put it into a byte array and recreate it.I notice that the files can be recreated correctly if they are of type .txt files.But jpg files can't be recreated and trying to open the jpg files gives an error.I don't think it is the file saving that is the problem since any files can be save.Rather it is the file recreating that is the problem.Can anyone help?
Hi all, Can someone please brief me on how to save 'pdf' files(there are about 15 files) into a SQL database and retrieve/open it from a datagrid? I have about 15 pdf files on my webserver and need to save it in the SQL database, so every pdf file saved in the database will have a primary key and the file will be saved either as 'ntext' or 'binary' type...I just have this rough idea. If someone has a ready code in VB.net then nothing better( i know thats a shortcut :) but it will help me like a tutorial. C# code will do too, I can then convert the code to Vb.net Thanks a ton.