Dropping vs disabling (no check) a foreign key
I want to truncate a "child" table, but it is referred in a foreign key; so truncation fails even there are no rows in parent table. Is only solution is to drop the foreign keys and then...
View ArticleSQL Formatting Tool
Guys,Is there any good tool available to format the SQL Code. I have bunch of stored procedures and I want to do proper alignment and formatting of the code. I was wondering if there is any free tool...
View ArticleAutomate saving SSMS query result in Excel sheet on Windows Server 2008 R2...
Hi there,I am trying to do a simple thing. I just want automate storing the result of a T-Sql query in an Excel sheet. Manually I select all in the resultgrid of SSMS an copy with headers.Then I open...
View ArticlePartitioned views : how to filter on the partition key in a stored procedure ?
I am using partitioned views in SQL Server 2008 R2. When I create a query filtering on the partition key (customerID), I get partition elimination as expected. But when I use a variable to filter on...
View ArticleQuery help
Create table #temp(ID int identity(1,1),ActivityName varchar(max),ApplicationName varchar(100),ActivityDate datetime)Insert into #tempValues('Successfully Login into Dynamic Portal...
View ArticleSQL Question
Get the error when run the SQL Query, anyone can help me?SQL:UPDATE BOM SET EQM_UPDATE_DT_GMT = (Select distinct (UPDATE_DT_GMT) from dbo.EQM WHERE EQP_NUM = 'TCKU364304' AND FAC_NAME = 'SIN01' )...
View Articlescript for enabling notification(mail alert and write to event log for SQL...
Can some one please share the script for checking the notification enabled or not on job properties of SQL agent.ALso provide me any scirpt for altering the job properites . I have tried as like below...
View ArticleUsing a query to expand a data set
My only experience with sql queries is to return a defined set of data, but now I need to expand a data set. My data table is populated as follows:Tenant Rent Lease_from Lease_to A...
View Articleneeded store procedure to refrech the database in sql server 2000 ?
Needed store procedure to refrech the database in sql server 2000 !! or i need store procedure extract the users and permistion to .sql file with job (with SP) to once location. and steps to run that...
View Articleshow columns within set date paramters
Hi there, I have a stored procedure to show data. I have one column in it, that I have convereted from a varchar to a datetime column. However I only want to show the values if the @ToDate is equal...
View ArticleSIZE OF MDF FILE IN SYS_MASTERFILES
Hello.I`m new in sql server and I need to do a query that convert the column size inSYS_MASTERFILES for MB. I want to know What the data type of columnsize? Thank you!
View Articlehelp with sql query
hii need help in sqlCE query i have this table:MEN === Item | NewQty | OldQty -------------------------- 111 | | 10 222 | | 20 333 | | 30 444 |...
View Articlehaving problem in creating table from another table
Hi all, I have a table with 2 columns named Depot_Id & Depot_Name, i have to make another table from the values inserted into Depot_Name as the columns of new table. I dont have any idea for...
View Articlehow to formate number in sqlserver 2005
hi,i would like to show degree at the end of number.how can i do it in sqlserver 2005ex1) 1234853487°2)23432.234°yours sincerely
View ArticleRegarding multiple inner joins and Full Outer join
Hi,I have four tables A,B,C and D. A is related to D via a column D1, B is related to D via column D2 and C is related to D via column D3.But there can be instances when C has some data for D3 and D...
View ArticleUsing MERGE to update and insert.
I have a temporary table with some data. I have another table with the name Employee_Master. Employee data regularly comes in an Excel sheet and this data is passed as XML to a stored procedure. In the...
View ArticleUnable to get a row count of the table returned
HI,My team is automating a scenario in which we used to do manual queries in SQL and now we are developing application in C#.The original query that we used to run in SQL was: "select count(*) as...
View ArticleHow can I rename wrong named table?
Hi All,I have a table named like dbo.[dbo].test but somehow I cant rename or delete it.How can I do it?thanks,G
View ArticleSum in SQL server
ID B C 1 2 9 ( C is sum of column B 2+4+3) row 1+2+3 2 4 8 (C is sum of column B 4+3+1) row 2+3+4 3 3 5 (C is sum of column B 3+1+1) row 3+4+5 4 1 6 (C is sum of column B 1+1+4) row 4+5+6 5 1 5 (C...
View ArticleWeird problem with the client
Hi everybody,I am trying to help the client with the strange problem. Instead of UPDATE command that he is supposed to be running according to the code in the application, he is running INSERT which is...
View Article