select where function very slow.. alternatives for simple asp.net page?
This is very slow:select * from apt_files_detailed where apt_department = [dbo].APT_GetDept ('domain\jdoe')yet these are not:select * from apt_files_detailedandselect [dbo].APT_GetDept('domain\jdoe')I...
View ArticleInsert/Update trigger example needed
Hi Could I please have code example of an insert/update trigger which on insert or update checks if the field x has value 'abc' and if so sets its value to 'xyz'? I need it to work for multiple...
View Articletutorial about sql Management Studio
Where can i learn about sql Management Studio?i'm already knows basic sql. what i realy want to learn is about things specific to the sql Management Studio environment such as how to make titles in my...
View ArticleUse Date if Exists
I have tables A and B. Table A contains dates for all rows, but I need to use table B dates if they exist for matching rows in Table A.I need to select all rows in Table A and replace the dates that...
View ArticlePermissions to delete Stored Procedures
Hi,I have a database MainSys with a stored procedure that will back-up the database and then restore it to a new database TestSys.Within the MainSys database there are several objects including a...
View ArticleIs there a better way to write this query?
Hi All,I have a table with structure shown in the code below(though table is simplified to make it easier to explain). Basically, this is similar to a transaction table but stores aggregated...
View Articlesql result to html - format cell
i'm send alert email from sql server for daily attendance by convert select results to html as below , but wondering how could i apply formatting on result for example display late checkin in red and...
View ArticleSelecting a currently updated row from table in SqlServer 2008
Hello Techies, I have a requirement that when a record will be updated in table i would like to retrieve the same record. I dont have any criteria field. How can i get the changed Record.Please...
View ArticleDynamic Update
Hi Everyone,I need to update a table for 3 years and am using the below query which essentially is one update statement for each year. I am sure there must be a more efficient way to write this. Any...
View ArticleSQL Server Query Code Help
Hi all. I'm having a heck of a time trying to get my query to work. I have a table of ingredients:___________________________________ID NAME INGREDIENTS1 KITCHEN SINK...
View ArticleInconsistent performance of a script
Have you ever written a complex script and 99 times out of 100 it does EXACTLY what it is supposed to do? Then on that 100th run it does something unexpected? Like a record that should have gotten...
View Articlemy online university account is not opening
my uni online account is not opening and giving me the error(The transaction log for database 'vu' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in...
View ArticleIssue with a corelated subquery
Hi guys, just an advice. I'm not able to understand this SQL behavior:TBL Products ( id, name(varchar), description(varchar)TBL ProductSales ( id, productid (foreign keys), unitprice (int), quantity...
View ArticleGrammar describing SQL grammar in Books Online
I hope that the subject line does not confuse you. I am writing a parser, but I do not want to parseCREATE TABLE mydb.myschema.t1(f1 int).I want to parse the grammar used by Books Online to describe...
View Articletruncate table taking lot of time
Hello Professionals, I'm trying to truncate a table but it is taking lot of time. Even when I try to do Select top 1* from tableX it is taking more time and still...
View ArticleInvalid column name in @tablevariable not throwing error
DECLARE @IDListAll TABLE (allID INT) DECLARE @filterList TABLE (debtID VARCHAR(200)) INSERT INTO @IDListAll ( allID ) VALUES...
View ArticleTable Joins SQL query, group by clause error
We have a 4 tables this will be pulling information from in the statement that's currently not working. What we do is select all the companies from the companies table (1 of each company). SELECT...
View ArticleShare code with Oracle
Hi,I have a report tool where we use to connect it to different data sources, but use the same report. Until now, only MSSQL and Access have been used, but now it's time to go for Oracle. The T-SQL...
View ArticleT-SQL Total help
SELECT Datename(month, pr.daterequested) AS Month, pr.purchaserequestid, Count(pr.purchaserequestid) AS COUNTOFPRID, Sum(prl.totalcost) AS...
View ArticleCount of ID and cost per month
SELECT pr.PurchaseRequestId, pr.DateRequested, DATENAME( month, pr.DateRequested) AS DateRequested, SUM(prl.TotalCost) AS TotalCost, COUNT(pr.DateRequested) AS CountOFPRIDINMONTH FROM...
View Article