hi i created project using asp.net and sql server 2005.I created table and inserted datainto sqlserver 2005. but i dont how to find the(count) number of records stored in the table.how to find this?
Hello everyone,
I am learning and using SQL Server 2008 new Merge statement, merge statement will compare/operate source table and destination table row by row ("operate" I mean operations performed for when matched or not-matched conditions). My question is whether the whole merge process will be one transaction or each row comparison/operation will be one transaction?
Appreciate if any document to prove it.
thanks in advance,
George
I am trying to update records in an .mdb table with the number of records containing the same value
The sql below does not work but I think gives an indication of what I am trying to achieve.
UPDATE table1 AS A
INNER JOIN (SELECT PH_BSP , Count(PH_BSP) AS PHCOUNT FROM table1 GROUP BY PH_BSP) AS B
ON A.PH_BSP=B.PH_BSP
SET A.PH_SORT = B.PHCOUNT;
any ideas?
I have the following Transact SQL query using a union.
I need some pointers as to how this would look in LINQ i.e some examples
wouldbe nice or if anyone can recommend a good tutorial on UNIONS in linq.
select top 10 Barcode, sum(ItemDiscountUnion.AmountTaken) from
(SELECT d.Barcode,SUM(AmountTaken) AmountTaken
FROM [Aggregation].[dbo].[DiscountPromotion] d
GROUP BY d.Barcode
UNION ALL
SELECT i.Barcode,SUM(AmountTaken) AmountTaken
FROM [Aggregation].[dbo].ItemSaleTransaction i
group by i.Barcode) ItemDiscountUnion
group by Barcode
In my 2nd ASP.NET MVC project I'm facing a very weird problem: when I call the SubmitChanges method of the DataContext class, nothing updates in the database. It's weird because everything works fine with my first project.
I'm using a remote database created in Sql Server Management Studio, I tried doing some queries there and in Visual Studio 2010 (where I have the connection to the database), they all work.
Where might the problem be hidden?
I have Table and i want to copy data from row to another and vice versa and i have the rows IDs.
is there any query to do that because i don't want make it by .net code i think sql query is easier than that.
thanks
I want to copy data from a database to another, but I'd like to keep the primary key from the original database so it won't mess with the relationships. I'm using MS SQL Server 2008.
So i need to figure out how i can get a record count value and use that count as a new value to insert into a table.
Ex: In My Stored Procedure
@Count int
What im looking for
@Count to equal "select top (1) _fieldName from _someTable order by _fieldName Desc"
Finally
insert into _newTable (_fieldName) values (@Count)
End
I dont have to use a variable, just trying to demonstrate what im really trying to do. My SQL knowledge is pretty limited so no laughing, or smirking! ;)
This SQL query gives me today's number of users active in the last 30 days:
SELECT COUNT(*) FROM table.users WHERE creation_tsz >= (now() - interval '30 days')
How can I modify it to get not a single value, but a table of active users for a range of dates?
Thanks,
Rob
I have a table called Categories which contains category_Id and parent_category_Id, so each category can has a child and the child can has a child and so on (it is dynamic).
So if i have category A and category A has child B and child B has child C and child C has child D. I want to get all the child tree of A using SQL so when I give this query the id of A its result will be the ids of A's child which is B,C & D.....any ideas.
Thanks in regards,
Hi,
I am getting the following error: Invalid authorization specification
I've narrowed down the error to my connection string. I have verified the server name, database, user & password are correct. Here is the string:
"Provider=SQLOLEDB;Server=xxxxx.db.12345.hostedresource.com;Database=foo;UID=fooUser;PWD=fooPW"
The SQL server is hosted on Godaddy so I don't have access to its settings.
Please help, I've scoured the internet for a solution!
Hey,
I need to dynamically set the sproc name of a Linq to SQL query and can't figure out how. I see in the dbml designer that the sproc name is an attribute but it must be a constant, so I can't set it to a dynamic value. Please help.
Thanks,
Justin
Hi.
I'd like to indicate to SQL Server 2005, in my BEGIN CATCH...END CATCH block that the error is "handled"... That is, clear the error.
Is that possible??
Thanks.
A.
Ok, so I'm trying to select an amount of rows from a column that holds the value 3, but only if there are no rows containing 10 or 4, if there are rows containing 10 or 4 I only want to show those.
What would be a good syntax to do that? So far I've been attempting a CASE WHEN statement, but I can't seem to figure it out.
Any help would be greatly appreciated.
(My database is in an MS SQL 2008 server)
hi.
I have ten or more(i don't know) tables that have a column named foo with same datatype.
how can i tell sql that values in all the tables should be unique.
I mean If(i have value "1" in table1) I should NOT be able to have value "1" in table2
Hopefully this isn't a duplicate, but does anyone know of any (good) ORMs that work with SQL Compact Edition, and can run in the .NET Compact Framework (e.g. Windows Mobile 5-6.x)?
Hi folks
The activity monitor in sql2k8 allows us to see the most expensive queries. Ok, that's kewl, but is there a way I can log this info or get this info via query analyser? I don't really want to have the Sql Management console open and me looking at the activity monitor dashboard.
I want to figure out which queries are poorly written/schema is poorly designed, etc.
Thanks heaps for any help!
I want to leave sql profiler running all the time logging any queriy that runs for longer than 5 seconds. It's simple enough to start this using the profiler tool on my PC but how do I create it so it runs in the background on the server?
Hi everyone,
I want to make web service that will be interface for SQL reporting service. I really do not know much about that, I need some guidelines in order to solve this. Any help or suggestion would be helpful.
Thanks a lot.
Hello everyone,
I am using SQL Server 2008 Enterprise. I met with issue which says line 9 of store procedure foo is meeting with dead lock issue. My question is how to find exactly the 9th line of the store procedure?
My confusion is because of coding format issue, how to locate 9th line correctly.
thanks in advance,
George
UPDATE CustomerPhone
SET PhoneTypeID = 7, PhoneNumber = 999-444
WHERE CustomerID = 500 AND PhoneNumber = 9-1-1;
PhoneNumber is of type varchar(20) whereas PhoneTypeID and CustomerID are of type int. I'm running the above statement in SQL Server, it works fine.
I wonder how come it works? I thought any string value has to be put between '...'
Is it possible to have Outputs from PL/SQL in real time? I have a pretty huge package that runs for more than an hour and I'd like to see where the package is at a particular time.
Anyways, I currently do this with a log table, which gets filled up with hundreds of log descriptions per run, I'm just curious if this is possible.
Thanks!
im doing some practice sql problems
one of the questions is:
Prepare a shipping statement for
customer 'C001' it should show the
date, the legend 'Delivery' and the
total value of the products shipped on
each day.
'delivery' is not a table nor is it a column in any table.
what does legend mean??
Hi all,
I want to upload excel file using SqlBulkCopy into sql server 2005 table. My excel file size is 43MB. When i am uploading this file it will display error message that "The request filtering module is configured to deny a request that exceeds the request content length.".
My web.config file setting is
<httpRuntime executionTimeout="12000" maxRequestLength="2097151" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>
Thanks in advance.