insert data in increments
Does anyone know how to insert data into a table in increments of about 1000? I have a table with thousands of records that I want to insert into an identical table on a different server. ...
Does anyone know how to insert data into a table in increments of about 1000? I have a table with thousands of records that I want to insert into an identical table on a different server. ...
I'm using MS SQL 2005, and I want to check two dates for equality, but ignoring the time part. I know I can make use of DATEDIFF, but am concerned that it may be slow - this SP gets used in the DB a lot! Any suggestions? Edit: David Andres' comment: '"comparison" includes much more than equality' made me realise that I didn't make my...
A few minutes ago, while working out a new sproc, I executed the wrong delete statement. Something like this: Delete From SomeTable Where SomeStatusID=1 10 seconds into it, I realized that I typed in the wrong status and hit cancel. It said that the statement was canceled. I did a restore to a separate database to get back the table ...
How do I get the granted permissions for a stored procedure in sql server 2005? ...
I'm developing a timesheet application using SQL Server as my backend and I am trying to figure out the best way to handle implementing relatively complex processing logic in my DB for reporting purposes. I have a table (timesheet_entries) that is composed of the following fields: entry_id employee_id job_id job_state pto_code (this s...
I am looking at a large-ish SQL Server 2005 database, that has entered into Recovery mode, and I am wondering if there is any way to estimate how long it's going to be until the database has recovered? ...
When designing a database, what usually determines what tables will be the primary and foreign table in a relationship? For example, if I have a table called posts and it contains and id column postid and I have a table called comments and it contains a column called postid. Which of these tables would be the primary one in the relati...
I have this huge stored procedure where I am building a sql statement. At the end, I create a parameter list like this: DOES @paramList need and N in front of it?? SELECT @paramList = '@param1 nvarchar(300), @param2 nvarchar(10), @param3 nvarchar(10), @param4 nvarchar(100), @param5 nvarchar(1000), @param6...
I have a table that stores data from the county appraisal district. I want to add a computed column to tell me if the property is owner-occupied. I define "owner occupied" as true if the property address is the same as the owner address, false otherwise. Because of data entry inaccuracies in the source data from the county, if I do a st...
I have two tables, A and B. Both have the exact same columns. I need to select all the items in TableA that ARE NOT in TableB. This is intersection, right? How can I do this? ...
i have one table and one column in this.there is 15 data(integer).i want to count positive numbers and negative numbers and also sum of total numbers in one query . can any one help me ......... ...
I'm a little new to SQL and have come across the following problem. I have a table with company details on it which is joined to a contact table by an enqID. Within the contact table, there are 4 different types of contacts which may or may not have an entry. These are differentiated by a ctcTypID (1 - 4) I would like to produce a qu...
Two simple tables: T1 ContactId, Name, Department T2 AddressId OwnerId Address Added What I need to output is: ContactId, Name, Department, Address however I only want one record per cusomer, the oldest based on Added (datetime). Is this possible? ...
I'm currently trying to write a SQL Server 2005 function, which gets a string as parameter and creates a table with decimal values out of it. The problem is, that I have to define the decimal type based on parameters. This not working snippet should demonstrate the idea: CREATE FUNCTION [dbo].[ufn_ParseDecimal] ( @Sequence VARCHAR...
I know this is not a big issue, but it tickles me anyway. I have a SQL Server 2005 script to create new data tables, constraints, altering some tables to add columns, altering procedures to take the table changes into account, etc. Everything runs fine until the script encounters my ALTER PROCEDURE statements. The error message is as f...
Table example: TableName:DownTime Columns: EventID - int, ReasonID - int, StartTime - DateTime, EndTime - DateTime I would like to calculate the daily downtime of each event over the last 30 days. However, an event could be down for multiple days, so the start time would could start 31 days prior and could end next week. So I need...
Hey guys, I'm tasked with doing a SQL Server 2000 to 2005 migration. I will be doing a side-by-side migration. I've read from a few different sources that I can either: perform a backup of the database on SQL Server 2000, ship that backup to the new hardware and restore the database in SQL Server 2005; or detach the database on SQL Ser...
I have a scalar UDF that I know to be deterministic, however SQL doesn't. Is there a way to declare it as deterministic so that I can then use it in a persisted computed column definition? further clarification: The purpose of this exercise is that I need to harvest out specific values from an XML column on the row. I can't use the va...
Hi. Would really appreciate some help with a search angine I'm trying to make for a karaoke music site using ASP.NET and SQL SERVER... I have a table called Discs which has the following fields: ID, DiscCode, DiscTitle, DiscType, Theme, Manufacturer There is also a table called Tracks with the following fields ID, DiscID, A...
i have one simple table with following columns: id, name and parentID i created relationship diagram between id and parentID (on a same table), like simple tree, on the same table, but when i tried to user cascade delete it was disabled for me i know that it will be recursive delete if i will delete parent it will delete his children ...