Hello everyone,
I have a stored procedure that does, among other stuff, some inserts in different table inside a loop. See the example below for clearer understanding:
INSERT INTO T1 VALUES ('something')
SET @MyID = Scope_Identity()
... some stuff go here
INSERT INTO T2 VALUES (@MyID, 'something else')
... The rest of the procedure...
I'm having trouble setting up a report model to create reports with report builder. I guess I'm doing something wrong when configuring the report model, but it might also due to change of primary entity in report builder.
I have 3 tables: Client, Address and Product. The Client has PK ClientNumber. The Address and Product both have a FK...
What is the correct Syntax to be applied for "@[System::ErrorDescription]" inside the query like "INSERT" ? I am unable to retrieve the correct Error Description inside the table, as the result in the table is showing as "@[System::ErrorDescription]". I am not getting the result !
...
This line do not work: (the problem is in the last line)
SELECT Book_Name
FROM Books
WHERE (Year, Faculty) = (SELECT Year, Faculty FROM Books WHERE Book_Id = 1112);
How can I fix it?
...
Hi,
I have two servers where I installed SQL Server 2008
Production: RAID 1 on SCSI disks
Test: IDE disk
When I try to execute a script with about 35.000 inserts, on the test server I need 30 sec and instead on the production server more than 2 min!
Does anybody know why such difference? I mean, the DB are configured in the same way...
I was creating a stored procedure and i got stuck in the writing methodology of me and my collegue.
I am using SQL Server 2005
I was writing Stored procedure like this
BEGIN TRAN
BEGIN TRY
INSERT INTO Tags.tblTopic
(Topic, TopicCode, Description)
VALUES(@Topic, @TopicCode, @Descripti...
I need to write a trigger that rounds a value whenever it is inserted/updated into a table
...
So I installed a trial of SQL Server 2008 enterprise edition while waiting for MSDN licenses to come through - I now want to uninstall the trial and replace it with a developer edition installation.
However, I'd like to first know how long I have left on the trial. Is there a way to do this programmatically with SQL? I looked at creat...
I need to save WPF FlowDocuments to SQL Server. What is the best format for doing that? String? Blob? Does it matter in a document less than 5K words or so?
...
Hi, I want to generate some test data so for each row in a table I want to insert 10 random rows in another, see below:
INSERT INTO CarFeatures
(carID, featureID)
SELECT C.ID, F.ID
FROM dbo.Cars AS C
OUTER APPLY (
SELECT TOP 10 ID
FROM dbo.Features
ORDER BY NEWID()
) AS F
Only trouble is this returns the same value...
i've been using the following query:
select LEN(columnname) as columnmame
from dbo.amu_datastaging
This works, but is there a way to only return the greatest value instead of all the values?
So if i return 1million records and the longest length is 400, the query would just return the value of 400?
...
Im moving data from one table to another using insert into. in the select bit need to transfer from column with characters and numerical in to another with only the numerical. The original column is in varchar format.
original column -
ABC100
XYZ:200
DD2000
Wanted column
100
200
2000
Cant write a function because cant have a function ...
I tried the following code. Although I don't get any errors, it did not do it.
SELECT * FROM Categories EXEC sp_rename 'Active', CategoriesActive
...
What is the purpose of putting an 'N' in front of function parameters in TSQL?
For example, what does the N mean in front of the function parameter in the following code:
object_id(N'dbo.MyTable')
...
I'm trying to figure out the syntax for creating a view (or function) but only if a dependent CLR assembly exits.
I've tried both
IF EXISTS (SELECT name FROM sys.assemblies WHERE name = 'MyCLRAssembly')
begin
create view dbo.MyView as select GETDATE() as C1
end
and
IF EXISTS (SELECT name FROM sys.assemblies WHERE name = 'MyCLRAsse...
I'm thinking of building a Click-Once application, and am trying to wrap my head around how to handle the whole connection string issue. The problem is the following:
I want to use EF to get data directly from each client, thus requiring each client to have a connection string configured (this is not the issue). How do I deal with clien...
A variety of files (pdf, images, etc.) are stored in a ntext field on a MS SQL Server. I am not sure what type is in this field, other than it shows question marks and undefined characters, I am assuming they are binary type.
The script is supposed to iterate through the rows and extract and save these files to a temp directory. "filena...
I am trying to find a solution that will resolve a recurring deadlock situation in SQL server. I have done some analysis on the deadlock graph generated by the profiler trace and have come up with this information:
The first process (spid 58) is running this query:
UPDATE cds.dbo.task_core
SET nstate = 1
WHERE nmboxid = 89 AND...
I am new to SQL Server Management Studio and am wondering if there is a way to see what queries have been ran against a database. Surely there is a way to see these. In the Activity monitor, there is a "Recent Expensive Queries" but I'm guessing that isn't all of the queries since I'm not seeing the ones I have ran. I am running SQL S...
When i was reading books to learn C# (might be some old Visual Studio 2005 books) I've encountered advice to always use SqlCommand.Prepare everytime I execute SQL call (whether its' a SELECT/UPDATE or INSERT on SQL SERVER 2005/2008) and I pass parameters to it. But is it really so?
Should it be done every time? Or just sometimes?
Doe...