Check table existence and delete entire records using Server 2005
I am trying to delete the entire record of table after confirmation of Table existence using SQL Server 2005 SP3,query is as follows - USE smsDB; GO IF (OBJECT_ID('organTable', 'U') IS NOT NULL) BEGIN...
View ArticleSQl Query Help.
Hi Friends I want to make my query like below output. Out put should be like this below. ID String 1 U 2 UU 3 UUU it means if ID is 1 then it should in...
View Articledate formula
Hi, I have a column of birthdates. I need to calculate the day, month and year when the individuals turn 65 yrs old.
View ArticleCreate Backup with chosen facility using T-SQL 2005
i am aware with basic database backup tquery -BACKUP DATABASE smsDB TO DISK = 'C:\smsDB.BAK' WITH DESCRIPTION = 'smsDB_FULL_TRUE_TRUE_0607' GOi need to take backup which satisfied below options, which...
View ArticleSCD Type 2
Hi All,I have a typical requirement of implementing a Type 2 scd for following tableStaging Table MEMBER_ID,COV_MTH_ID,RELATION,MARITAL_STATUS 1001 201401 10 M 1001...
View Articlehow to get employee attendance based on device login
i am having two tables by name tempdevicelogs and emp_settings. In tempdevicelogs "logdatetime" is a coloumn and in emp_setting "emp_status" is another column. if any employee logs in then emp_status...
View ArticleA Report for top spent with Given Sitecode and Year
Customer CodeNameSpent2011xyzaaJon700.00nmcbStuart400.00bncxPrakash300.00nmsdSrinu200.00opklsKumar90.00 Table above as retrieved data For Site 01Rank the...
View ArticleNested functions, Sum of Last(mailboxcount)
Hi,I'm using a query whose output is based on Last(mailboxcount) & it is as follows:ServerMailbox CountABCD2345Based on LAST(mailboxcount)EFGH2234Based on LAST(mailboxcount)IJKL1123Based on...
View ArticleTraversing in a loop weekly
Hi,I have a loop in which I would like to Select query on weekly basis starting from the last date, essentially traversing backwards week-by-week. For example the table below represents the sample...
View ArticleNeed help with creating trigger using instead of insert.
Hi all,I am trying to create a trigger that can read the inserted Mail data from table1 and check if the Mail data matches the Mail data from table2. If the Mail data matches the Mail data from table2...
View ArticleHow do we find Database is deleted ? Can we get alerts or notications if...
Hi Team ,As part of Disater Recovery Test ,Higher management team is going to delete One Database from one of my production SQLServers .We need to find deleted database and need to restore the...
View ArticleCalculating 30,60,90 Days Totals in sql
Hi All,Here I have written a query to find the total for 30Days for a perticular member after the discharge date.These 30Days Amount will be populated into another table based on joins.Now my question...
View ArticleConvert SQL YTD into MTD
I have a SQL Database which store the value as YTD acorss all the periods and other fields . However for the reporting purpose , I would like to convert into MTD . We have huge amount of data store...
View ArticleHow much Memory should be allocated to SQL Server 2005
Hi,I have a SQL Server 2005 installation on a server having 64GBof RAM. SQL server is allocated 57GB of the available RAM.Could you please tell me what would be the ideal RAM allocation for my...
View Articleconverison
Hi all,I need to convert a convertvarbinary data toimage.Please help me how can I do this .Thanks
View ArticleI need to pull only text from the RTF data of a column in a table
Hi all, I have a table in database of about 10,000 rows, it has different columns, and in one of the column is Body column which has the data in RTF format, but I need to pull only the text from that...
View Articlemixed collation
I have different collation in my database then on the server. Every time when i define temp table inside query I also set its collation to database collation - to prevent collate conflicts.But what...
View Articlehow to get top 3 salaries from emlpoyee table department wise
Hi,I want to get top 3 salaries from each of the department. what can be the query?Create Table Employee ( EmployeeID Int Identity Primary Key, EmployeeName Varchar(10), DepartmentID Int , Salary Money...
View ArticleConditionally choose linked server
Hi, Have a stored procedure that accesses data via a linked server. Whilst testing we point to a test linked server and then change the procedure to a different one when it goes live. Not ideal.Was...
View Articlehow to access parameters via names stored in other variables
Hi, I have a list of string (with prefix '@') which are the same as my procedures parameter's list. So when I am trying to access a string from this list, its give me the name of that parameter and...
View Article