SQL Server :: How To Run Completely A Big Query
Jul 18, 2010i have a big query and many data
when i try to execute this query i got this error
how can i run this query complete?
i have a big query and many data
when i try to execute this query i got this error
how can i run this query complete?
import/export wizard in 2000 had lots of options.
I could copy databases without a care in the world. Including constraints, stored proc., AND the data, etc.
Now, with v2008, the wizard is dumbed down too much. It's a "stupid" copy function that fails on the first constraint it meets.
"Copy database.." is not an option here: it needs sysadmin on both source and destination server.
Re-adding the constraints manually is not an option either: the database is WAY too large.
I'm actually hoping there is a temporary bug in the import/export wizard. Each option (and you have THREE...) returns with a new error.
Googling, I found I am not alone:
http://itknowledgeexchange.techtarget.com/itanswers/sql-server-2008-export-data-problem/
This post is exactly my situation. Here's what his post says: (bolded key parts)
I'm trying to get used to sql server 2008 having been forced to upgrade by my isp. I need to back up my key db on a weekly remote schedule, so have been trying to use ssms to export data from my remote db to a local copy.
Firstly I created a new empty db on the local machine. Then I scripted the structure of the db on the remote machine and ran the resulting query on the local machine to copy the table structure into the new db. This gave me empty target tables to map to (see
below).
I used the export data wizard and selected my remote tables, then highlighted the tables to be copied and used the Edit Mappings option. Here I need to do two things, firstly checking'Enable Identity Insert' (because I have a unique id in most tables which is identity seeded, and I've read that if this is not checked sql server will helpfully renumber your entire table, rendering all your foreign key references useless). Secondly I need to decide what to do with the data already in the destination table. SQL 2k DTS simply dropped the destination table and recreated it. SQL 2008 will either keep the structure and delete the rows therein, or drop the table and recreate it. Because I intend to save this package and call it on a schedule in the future, I need to choose one of these options, because next time the target db won't be empty.
If I choose the delete rows option, when the package runs I get the following error when the process gets ot the first table with an identity ID which is used elsewhere in the db as a foreign key.
Error 0xc002f210: Preparation SQL Task 4: Executing the query "Truncate TABLE [dbo][tblCompany] failed with the following error 'Cannot truncate table tblCompany because it is being referenced by a foreign key constraint. Possible failure reasons: Problems with the query, "Result Set" property not set correctly, parameters not set correctly or connection not established correctly'
Half a dozen preceding tables did seem to transfer fine, but the process falls down on this one table. What I want is for the process to ignore constraints whilst it does the backup.
Undeterred I tried the other option, dropping each table and creating a new version. This time I get the error:
Error 0cx0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code 0x80004005. An OLE DB record is available. Source MS SQL Server Native Client 10.0. Hresult 0x80004005 Description "The statement has been terminated".
An OLE DB record is available. Source MS SQL Server Native Client 10.0. Hresult 0x80004005 Description "Violation of Primary Key constraint 'PK_LoginClasses'. Cannot insert duplicate key in object 'dbo.LoginClasses'.
Then I try unchecking the Enable Identity Insert option to see what happens. This happens:
- Validating (Error)Messages
Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "UserID".
(SQL Server Import and Export Wizard)
Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
(SQL Server Import and Export Wizard)
Error 0xc004706b: Data Flow Task
1: "component "Destination - Login" (40)" failed validation and returned validation status "VS_ISBROKEN".
(SQL Server Import and Export Wizard)Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
(SQL Server Import and Export Wizard)
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
(SQL Server Import and Export Wizard)
I can't see any more options to try. So how do I get SSMS 2008 to do what Enterprise Manager 2k did with no drama?
By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.
View 10 RepliesI am trying to create statitics for game downloads and am having dificulty with a sub part of my query. the goup by command is not having the disired result and i think i have been looking at it too long to see what i am doing wrong. [Code]....
At the moment it is producing each result in many rows when only 4 rows should appear. its the download column that is doing it. needs to be sub queried or something to display total in relation to month,gameid,userid.
Month-download-GameID-UserID
1 1
1 1
1 1
1 1
I am trying to display this query result in an aspx page.
It is very slow in loading. Here is the query. The inner query inside the outer quesry is the problem.(Please see the underlined part in the query) - (If I remove that part it is very fast.)
select
top 500
--This column is the issue
,Governing_Class=( case when exists (select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.appid and tqc.class_code not in('8742' ,'8810','7380')
order by tqcm.premium_amt desc
)
then ( select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.
appid
order by tqcm.premium_amt desc
)
......... From tables
I am a biggner in SQL DB . but i started a complicated and painfull work in SQL SERVER 2008. the problem convert Oracle hierarchical query to SQL query. the query
SELECT DISTINCT
LEVEL LVL,
SCH.NSCHEDULE_SL,
SCH.NSCHEDULE_SL_FM,
SCH.CSHED_CNAME
FROM FA_SCHEDULES SCH
WHERE LEVEL = 1
AND NSCHEDULE_SL_FM IS NULL
AND NBRANCH_SL = 2
CONNECT BY PRIOR SCH.NSCHEDULE_SL_FM = SCH.NSCHEDULE_SL
AND NBRANCH_SL = 2
i have tow query in one stored procedure
first query and the second one every of them return only value
i want to copy the result of tow values in a new row in new table
as i want to check on this tow values in ado.net
i want to get only this tow values as a row not first and secon query
only a row has result of first and second query results
[Code]....
How can I SELECT second if first SELECT returns nothing?
View 8 RepliesUsing sql server 2005.
I have an Query A of fields that returns X number of records.
I create a Query B of same fields that returns X-80 number of records.
I want to find out the 80 records that are in Query A but are not in Query B. what is the syntax for this?
Trying to get a query going in SQL server but I get bad/ errors in the query.I have a 2 tables. One is the "Project" table while the other is the "Task" table.Table structure is as follows.
Project table => ProjectID,ProjectName
Task table => TaskID, TaskName,ProjectID,Quarter, Hours
A project can have many task. The ProjectID in Task table is the foreign key which reference the project ID.What I need to do is to SUM all the hours in the Task table and group it by quarter and then group it by ProjectID. Output of the SQL should be in the form of projectID,Quarter, Hours.
I am trying to make a UserControl that have all data process, initialize data, ajax, all self contain into one control.So I can insert to anywhere on my Asp pages.But the problem is, the UserControl contains a Script Manager and the Page that contain that User Control has a Script Manager too, so Asp doesn't allow me to have two Script Manager in one page.In case like this, I wonder if UserControl can completely self contain?Or the proper way of using UserControl is just using it like a template, and all the data process, event handler I have to do on the page that contains the UserControl?
View 1 RepliesTechnology: ASP.NET 4.0, C#, forms/mvc
I am a .NET web designer and I wish to create a modular based website for people, similar to what DNN does (but I want to create my own cut down version).
The idea is that I create a base website that can 'activate' features which the client needs (and has paid for). These features may be used by many clients which require frequent future updates for all clients (so I wish to keep upgrade time down to a minimum).
For example, I upload the base web application using web deploy and it sets up the core database tables/views/SPs in the process.Then I login into the website as developer and activate the out of the box features that I wish to permit the user to take advantage of. The only way I can think of currently is via user control, resources etc..But I need a little of your experience and advice over what the possibilities / dangers are....
e.g. images for an application e.g. blog, that I have activated for a client - how do I reference those images
e.g. Can user controls be dynamically added to a web application (which is pre-compiled unlike a website - it must be a web application since I am using web deploy).
e.g. Modification of web.config to add additional routing (doesn't matter if app has to go down to do this).
I can upgrade websites features en-mass, rather than manually enhancing each individual website which given a certain amount of clients would result in an awful amount of time lost.I do not have access to sharepoint (nor do I intend to). how to automate modularity completely via a front end in asp.net would be superb! how to reference files and resources outside of the websites directory and without using virtual directories
need to turn off the cookies in my ASP.net site completely
I'm doing some funky stuff serving images and scripts from a .aspx file, which causes the request to have cookies tagged to it.
So, how do I get rid of these?
I've tried setting the SessionState mode="Off" in the web.config, but that didn't seem to work.
Is there any way to completely ignore line break and tab characters etc. in RegEx?
For instance, the line break and tab characters could be found anywhere and in any order in the content string.
[code].....
Our current web portal at work was a port from a classic ASP codebase. Currently, all pages in our project extend a custom Page class called PortalPage. It handles login/logout, provides access to a public User object for the currently authenticated user, and adds the standard page header and footer to all of our pages. Every Page in our site is 100% designed in the codebehind. The ASPX page is not used at all. Every single div, img, and block of text is allocated as an object and added from a C# function, even if it is completely static content (which we have a decent amount of). Example for a page header:
HtmlGenericControl wrapperDiv = new HtmlGeneric("div");
HtmlAnchor bannerLink = new HtmlAnchor();
HtmlImage banner = new HtmlImage();
bannerLink.HRef = "index.aspx";
banner.Src = "mybanner.png";
banner.Alt = "My Site";
bannerLink.Controls.Add(banner);
wrapperDiv.Controls.Add(bannerLink);
this.Page.Controls.Add(wrapperDiv);
Even worse, all Javascript is added to the page as a giant mess of string concatenations:
ClientScript.RegisterClientScriptBlock(this.GetType(), "javascript", @"
<script language='javascript'>
fullUrl = '" + ConfigurationManager.AppSettings["fullUrl"].ToString() + @"';.............
I am using Logout button in my pages.Logout button calls the Logout.aspx page. Logout.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
Session.Clear();
Response.Cookies.Clear();
Response.Redirect("default.aspx");
}
MyInbox.aspx.cs:
if ((string)Session["uname"] == null)
{
Response.Redirect("Logout.aspx");............
Completely disabling viewstate
View 6 RepliesI want to create a complete dynamic view engine in that absolutely all html content will be loaded from a database. This is so I have a templating engine that is totally customisable. I have something similar in classic asp and the way that works is with fillpoints so you have a master page html which will just be a string when extracted from the database and then content is dynamically added to the string to sections identified by a fill point. So for example I have my master page content loaded into a C# string and I want to load a main view and a partial view onto the page, how would you go about that in MVC? I guess I would have to keep the fill point idea as there is no other way to know where the content will go. I'm just after opinions from the community really on how to go about it.
View 3 RepliesWhat I have is a masterpage with some tables and contentplaceholders. What I want in some pages is that a table be removed because i have 3 columns on 3 tables and i need 2 columns only(so minus one table). Now i can access the table and give it some css through code but what i give is width:0 (and visibility:hidden if ever successful). The table contains one contentplaceholder inside a <td>. I can also access the td.The problem is that the table (thus contentplaceholder) will not go away.
It remains as entity as extending the second column will just push it downside(behavior expected when the column3 with contentplaceholder is present). So is there a way to remove the table holding the contentplaceholder?Only thought is to hide it and push it right that i admit i haven't tried it yet, I suppose it would be easier to make another master page but the problem is that i want specific designs on many pages so if this does not work i would either have to make many master pages or just use simple pages.
I want to transfer the data from one server to another by sql query. I want query. I dont know how to write?
View 2 RepliesI have the following query that uses a linked server that is on a different VLAN of our network:
[Code]....
It works fine in Query Analyzer but when I put it into Visual Web Developer 2008 Express as a SQL Data Source I get an error:
"OLE DB Provider 'MSDASQL' reported an error. Authentication failed."
How to completely disable ControlState in an ASP.NET website application to get rid of <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/ACBDEFGH...XYZ=" /> on every page?
Searching for a solution, I only found meaningless answers making no difference between ControlState and ViewState, or replies saying that "we cannot disable control state". The second assumption seems to be false, since StackOverflow pages do not have ViewState hidden field.
Instead of using textbox1.text="", what is the code to clear the textbox value completely into null/nil /
View 5 RepliesI am trying to prevent VS from breaking on JS errors.
I have the following settings:
In IE, under Tools->Internet Settings->Advanced (tab)->Browsing
Disable script debugging (Internet Explorer) is checked.
Disable script debugging (Other) is checked.
In VS, under Debug->Exceptions->Common Language Runtime Exceptions JScript Exceptions (thrown and user-unhandled) are unchecked.
In VS, under Tools->Options->Debugging->Just-In-Time
Script is unchecked.
There are some JavaScript errors that I just don't care about and it is driving me insane having to deal with them.
I have a site that features some pages which do not require any post-back functionality. They simply display static HTML and don't even have any associated code. However, since the Master Page has a <form runat="server"> tag which wraps all ContentPlaceHolders, the resulting HTML always contains the ViewState field, i.e:
<input
type="hidden"
id="__VIEWSTATE"
value="/wEPDwUKMjEwNDQyMTMxM2Rk0XhpfvawD3g+fsmZqmeRoPnb9kI="
/>
EDIT: I tried both variants of setting EnableViewState on page level with no luck at all:
<%@ Page Language="C#" EnableViewState="false" %>
<%@ Page Language="C#" EnableViewState="true" %>
I realize, that when decrypted, this value of the input field corresponds to the <form> tag which I cannot remove because it is on my master page. However, I would still like to remove the ViewState field for pages that only display static HTML. Is it possible?