I have a table with a whole name. I have a function that receives said name, parses it, and returns a table with first, middle, last, and suffix. I have a bad (edit: was "hyper-conservative") DBA who won't upgrade the dev server to the same version as the production one so I can't just use APPLY and be done with it:
insert into blah (...
I am trying to find the fastest way to find all of the records in a parent table that do not have certain records in a child table. For example, I want the query to return all of the family records where there are no male children or no children at all.
Example 1
This is painfully slow:
SELECT * FROM Families
WHERE Families.FamilyID ...
I have 5 databases which represent different regions of the country. In each database, there are a few hundred tables, each with 10,000-2,000,000 transaction records. Each table is a representation of a customer in the respective region. Each of these tables has the same schema.
I want to query all tables as if they were one table. The...
Hello I am coming from Bosnia and Herzegovina and in our county the smallest note bill is 0.05,
Now the government pushing us to our retrial prices rounding on 0.05 or at 0.00.
Therefor I want to create SQL Scalar Valued Function for rounding the prices on given value.
Is there some build in solution so I can save resource of my querie...
I would like to know how this query would be written if no joins were used. I been trying to figure it out for cases where joins aren't viable or can't be used(aren't available).
SELECT
*
FROM
(
table1
INNER JOIN
table2
ON
table1.id = table2.id
)
INNER JOIN
table3
ON
(
table1.id2 = table3.id2
)
AND
(
table1....
I have a table with varchar(128) column with data like:
word1, word2, , word3, word4
word1, word2, word3, ,
word1,,,, ; word2
;word1 word2, word3
I have to update this table, making words reverse order:
word4, ,word3,,word2 ,word1
,,word3, ,word2, word1
Could you help me to do it using only single sql query??
...
I'm wondering if there is a tried/true method for reporting the progress of a DB call from a .Net application to its user. I'm wondering if it's even possible to actually indicate a percentage of completion, or is the best/only approach to simply display a "loading" animation to indicate that something is happening?
Also, does SQL2008...
I am fairly new to Linq To SQL but trying to run what should be a fairly simple SQL query and can't figure out how to make it play nice in LINQ.
SELECT Users.Id, Users.Id AS Expr1, Users.FirstName, Users.LastName,
User_x_Territory.UserID
FROM Users LEFT OUTER JOIN
User_x_Territory ON User_x_Territory.UserID = U...
I have a user defined function defined in SQL Server. I want create a single select statement that would be able to execute the function on all rows in a particular column. Is this possible and what would be the best way to do it?
Thank You
I saw this 'Execute table-valued function on multiple rows' and dont believe it answers my que...
I used the SQL Server management studio on a table with Create Script to New and did minor changes. Give me an error "Incorrect syntax near '('" for the "(" after "WITH"
/* EventType Table Creation */
CREATE TABLE [EventType]
(
[pkEventID] [int] IDENTITY(1,1) NOT NULL,
[Description] [nvarchar](50) NOT NULL,
[BeginDate] [datetime]...
I am trying to become more efficient in my SQL programming.
I am trying to run a loop to repeat an update command on field names that only change by a numerical suffix.
For example, instead of writing out x_1, y_1, then x_2, y_2 for each update:
DECLARE @a INT
DECLARE @b VARCHAR
SET @a = 1
WHILE @a < 30
set @b = @a
BEGIN
UP...
Finally checked out L2E framework and ran into problems almost instantly.
Yeah, i know... i should read some books before.
Situation:
entity with props -> id and name.
entity is mapped to table, which has id and name columns.
sproc, which returns ONLY id column.
Problem:
ObjectResult<MyProp> result = _container.MyStoredProced...
We are working on a large Java program that was converted from a Forte application. During the day we are getting Blocking SPID's in the server. We had a DBA visit yesterday and he set up a profile template to run to catch the locking/blocking action. When we run this profile the blocking problem goes away. Why?
This application is dist...
I have the following PHP code, which is meant to insert data in the event that the username field is empty for a given username, or update data if a username exists. At the moment, the insert was previously working fine, but it would never switch to the update clause.
Now however, the insert clause fails to recognise my test variable, f...
So i have run into a problem in that we keep having complex SQL queries go out with errors.
essentially this results in sending mail to the incorrect customers and other 'problems' like that.
What is everyone's experience with creating SQL queries like that, essentially we are creating new cohorts of data every other week.
so here ar...
I have a table. I'd like to search within this table for duplicate titles.
Lets say my data is as follows:
title1, title2, title3, title1, title4, title2, title9
I'd like for my query to search this table and output only the duplicates. So the output would look like:
title1
title1
title2
title2
I know how I can find the duplic...
Hey guys,
I am trying to import some data to SQL Server 2008 by means of Bulk Insert, but I've been getting a ton of conversion errors:
Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 5902, column 2 (Type).
OK so first things first:
a) the da...
I have a table that may have about 100 records or so, with a user name field. There may be many records with the same username. How would I ensure that only one record for each username is returned, regardless of which record it is?
e.g. for the following table
users
username item firstname lastname
-------------------------------...
I have the following conditional code, which will insert a new record if a record with the appropriate username does not exist, and update the record if it does exist. This works fine.
However, at the moment, if I insert a new record, and only insert the firstname and lastname, and maybe address details with say phone information being ...
I have a table of product. I have listed the items with pagination using rand() function. When using rand(), it displays the items in random order but the record is repeated while we go from 1 page to another page.
Is it possible to get non repeated items in each page using rand()? If yes how, if no what may be the option for this.
...