UPDATE
MRT
SET
Date = MR.Date
FROM
MRT
JOIN MR on MR.SKU = MRT.SKU
HERE Is where i would like to do an order by min(mr.Date)
All I get is an incorrect Syntax error.
I have to set the date = the smallest mr.date
...
Is there any free tool or plug-in for Visual Studio to convert the SQL tables to entity,model,facade and DAO classes? I am working on SQL server 2008, Visual Studio 2008 and C#.
...
Sample Query:
CREATE PROCEDURE dbo.Test (@p varchar(10))
AS
DECLARE @param varchar(10)
SET @param = @p + '%'
SELECT * FROM table1 t1
INNER JOIN table2 t2 on t1.id = tr.id
WHERE t2.desc LIKE @param
I've a query which is similar to one above and when i use this in stored procedure it runs indefinitely without giving any output. But if ...
hi my dear friends :
what is the best way For Transfer Data From One DataBase (sql server 2008) To Another db(sql server 2008) With Different Schema?
is there a program for doing that ?
thanks 4 your future asnwer
best regards
...
I have column with values that have wrong character ?. Now I want to change it to character b. For this I am using this statement:
SELECT REPLACE(name,'?','b') from contacts;
But when I do this nothing's happening, it return value with ?.
What I am doing wrong? How I can replace this?
...
Hi,
I have to insert large amount of data into a table. Does sqlserver 2008(compared to 2005) has any new features to increase the performance in this case ?
...
I am confused reading statements in "Why is 1899-12-30 the zero date in Access / SQL Server instead of 12/31?"
Was there date type in SQL Server before 2008 version? I cannot find.
In SQL Server 2008 zero date is 0001-01-01. Were there any date type before (in previous SQL Server versions) how is it backward compatible?
...
Declare @strxml varchar(max) = ''
This is the newly added feature in sql server 2008 which allows us to initialize the variables at declaration itself.
When I'm executing these commands in sql management studio 2005 I'm getting aN error message.
"Cannot assign a default value to a local variable."
...
I'm used to EF because it usually works just fine as long as you get to know it better, so you know how to optimize your queries. But.
What would you choose when you know you'll be working with large quantities of data? I know I wouldn't want to use EF in the first place and cripple my application. I would write highly optimised stored ...
Hello!
I need a SQL Server Query for the following scenario:
The Tables:
CREATE TABLE [dbo].[JobStatus]
(
[OID] [int] IDENTITY(1, 1)
NOT NULL,
[Name] [varchar](100) NOT NULL,
[Code] [varchar](5) NOT NULL,
[PictureID] [int] NOT NULL,
[LastModifiedAt] [timestamp] NOT NULL,
CONSTRAINT [PK_JobStatuses]...
Hi
I'm trying to insert some data from a XML document into a variable table. What blows my mind is that the same select-into (bulk) runs in no time while insert-select takes ages and holds SQL server process accountable for 100% CPU usage while the query executes.
I took a look at the execution plan and INDEED there's a difference. The...
I've picked up some SQL similar to the following:
IF EXISTS(SELECT name FROM tempdb..sysobjects WHERE name Like N'#tmp%'
and id=object_id('tempdb..#tmp'))
DROP TABLE #tmp
into #tmp
select * from permTable
I need to add more data to #tmp before continuing processing:
insert into #tmp
select * from permTable2
But this gives errors ...
How do you make it so that all calculations in the DB compute to a pre-specified # of decimal places? Say I have three tables with the following fields
Table1
A int
B decimal(18, 3)
Table2
A int
B decimal (18, 2)
C decimal (18, 3)
Table3
A int
Precision int
Now I need to change it so that all my calculations are based on w...
I'm working in SQL Server 2008, and I'm trying to select into a temp table based on a certain condition...for a report, I need up to 18% of the records to be of a certain product type.
if ((@totalRecords * .18) > @productTypeCount)
select * into #tmpLP_REIT
from myTable where productType = @productType
else
select top 18 per...
Is there a way in SMSS to detect whether a table has any records? I need to get a list of tables that have records. perhaps there is a sql statement that will do the trick?
...
RCustomerId GiftRegistryId ContactId DateActive DateExpire
----------- -------------- --------- ---------- ----------
62 66 225 NULL 2010-10-11
62 66 228 2010-10-13 NULL
62 67 229 NULL 2010-10-20
62 ...
I have a read only database (product) that recides on its own Sql Server 2008.
I already optimized queries by looking at most expensive queries in activity monitor - report. I ordered the report by CPU-cost. I now have something like 50 queries/second and no query is longer than 300ms.
CPU-Time is ok (30%) and Memory is only used by 20...
One of the most important databases that I administer is poorly designed. The program which uses it uses only 1 login which happens to be a System Administrator. Edits and deletes are done in place so change tracking is difficult.
Further, it lacks proper auditing functionality so I cannot tell which user edited or deleted a certain re...
I googled but cannot find proper simple code for using backup database full and restore the backup, using defaults by using C#.
I am using C# Visual Studio 2008 and SQL Server 2008 R2 evalution but I guess SQL Server 2005 and C# will work too.
The Microsoft site doesn't have code regarding it, it only show description of Microsoft.SqlS...
I am creating a new schema in SQLServer 2008.
Should I create a new user with the same name as schema owner?
Should I use 'dbo' user as schema owner?
...