Click here to Skip to main content
Page 1 of 5
Page Size: 10 · 25 · 50


Author filtered by: gvprabu [x]
Forum Message 13 May 2013  
Hi, Check the Script SELECT M.ID,(ROW_NUMBER() OVER(PARTITION BY M.EmpID ORDER BY M.EmpID)) 'RowNumber', M.EmpID, M.Leave_Year, M.Taken, M.Credit, (SELECT SUM((ISNULL(Balance,0
Answer 13 May 2013   license: CPOL
Hi,Try this...SELECT distinct r.rate as Rate,f.bthid as Batchid,CASE WHEN r.rate = '1' THEN '100' WHEN r.rate = '2' THEN '75' WHEN r.rate = '3' THEN '50' WHEN r.rate = '4' THEN '25' ELSE '0' END AS Translated_Rate FROM bthfac fINNER JOIN faculty fa ON...
Answer 13 May 2013   license: CPOL
Hi,Check the following CodeSELECT GETDATE()GO-- SQL Server 2000/2005SELECT CONVERT(VARCHAR(8),GETDATE(),108) AS HourMinuteSecond,CONVERT(VARCHAR(10),GETDATE(),101) AS DateOnly;GO-- SQL Server 2008 OnwardsSELECT CONVERT(TIME,GETDATE()) AS HourMinuteSeconds;SELECT...
Answer 10 May 2013   license: CPOL
Hi,Check the following Script...SELECT COALESCE(From_Place,SUBSTRING(Area,1,CHARINDEX(' TO ', Area, 1))) 'From_Place',COALESCE(To_Place,SUBSTRING(Area,CHARINDEX(' TO ', Area, 1)+4,LEN(Area))) 'To_Place',NULL AreaFROM SOURCE Regards,GVPrabu
Answer 9 May 2013   license: CPOL
Hi,You can use COALSEC[^] and BETWEEN[^] logic for this. Try like this....create procedure [dbo].[SP_RPTGetMRFsForResMgr] ( @MRFM_FrDt varchar(10), @MRFM_ToDt varchar(10))asbegin select ..... from...
Answer 9 May 2013   license: CPOL
Hi ,Check the following linksNULL, NULL, NULL and nothing but NULL[^]Difference between NULL and Empty/Blank value[^]Null vs Empty (Zero Length) string[^]SQL: empty string vs NULL value[^]Regards,GVPrabu
Answer 9 May 2013   license: CPOL
Hi,Check the following Query... use OR Operator for this simple checking.Declare @RRPTDemandStatus char(7) = nullselect mpd.MPD_DemandStatus, m.Description,* from RPT_MRFProgressDetails mpdleft outer join MasterData M on mpd.MPD_DemandStatus = M.Idwhere ((mpd.MPD_DemandStatus =...
Answer 8 May 2013   license: CPOL
Hi,Check the following links....Comparison Operators (Transact-SQL)[^]Use NOT operator in where clause[^]Null Values And The T-SQL IN Operator[^]SQL Server All, Some and Any Operators[^]Regards,GVPrabu
Answer 8 May 2013   license: CPOL
Hi,Check the following links.. u will get Idea.Export in Excel With using OPENROWSET from Stored Procedure[^]Using T-SQL, export resultset to Excel [^]Exporting A Csv File Via A Stored Procedure[^]Once try, If any difficulties then get back to us...Regards,GVPrabu
My vote of 5 by gvprabu
Forum Message 8 May 2013  
Nice examples and fully informative. thanks a lot for your article.
Answer 7 May 2013   license: CPOL
HiCheck the following Query... try like this.SELECT CASE WHEN M.DispOrd=1 THEN 'CLASS '+ M.Class WHEN M.DispOrd=2 THEN 'TOTAL NO OF STUDENTS '+ M.Class + ' ' + CAST(M.Count AS VARCHAR(10)) WHEN M.DispOrd=3 THEN 'STUDENTS PURCHASED '+ M.Class + ' ' + CAST(M.Count AS...
SQL
Answer 6 May 2013   license: CPOL
Hi Friends,download the Microsoft Training Kit or MSDN (very nice referances)SQL Server 2008 R2 Update for Developers Training Kit (May 2011 Update)[^]So many books are there for SQL Server....Check the following booksSams Teach Yourself Microsoft SQL Server T-SQL in 10 Minutes...
Answer 5 May 2013   license: CPOL
Hi,I think its not Query Proble, Problem in Frontend Code.Check the following LinksError: Invoke or BeginInvoke cannot be called on a control until the window handle has been created[^]Invoke or BeginInvoke cannot be called on a control until the window handle has been...
Answer 3 May 2013   license: CPOL
Hi,Try like as follows,SELECT ROW_NUMBER() OVER(PARTITION BY M.id, ORDER BY M.suborder) 'RowNo',M.id, M.suborder, STUFF((SELECT ','+suborder AS text()FROM table_nameWHERE ROW_NUMBER() OVER(PARTITION BY id, ORDER BY suborder) 1AND id=M.ID FOR XML PATH(''))),1,1,'')...
SQL
Answer 3 May 2013   license: CPOL
Hi,Check the following links... Its helps u.SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified[^]SQL SERVER – FIX : ERROR [^]SQL 2008 R2 error: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified[^]Regards,GVPrabu
Answer 3 May 2013   license: CPOL
Hi,Check the following sample Link...Export data from SQL Server to Excel[^]Export to Excel[^]Different Options for Importing Data into SQL Server[^]SQL Server Export to Excel using bcp or sqlcmd Utilities and CSV Files[^]Regards,GVPrabu
Answer 2 May 2013   license: CPOL
Hi,You can use UDT (User Define Type) as Table Perameter for SPs. Then u can pass all records in onee time. Check the following Example. You will get clear Idea about this Process (Front end and Backend).Sending a DataTable to a Stored Procedure[^]Regards,GVPrabu.
Answer 2 May 2013   license: CPOL
Hi,Check the following links.... U will get Ideas about SQL Joins.Different Types of SQL Joins[^]SQL - Joins [^]SQL SERVER – Introduction to JOINs – Basic of JOINs[^]Joins in sql server, Inner Join,Cross Join,Left Outer Join,Equi join, Right Outer Join, Full Outer Join...
Answer 30 Apr 2013   license: CPOL
Hi,You will use Linked Server Concept or SSIS packages.I will give you the link for Creating Linked Server.How to create Link Server with MS SQL 2005/2008[^]SQL Server - Linked Servers[^]Once you Create the Linked Server, then use Query as follows.SELECT * INTO...
Answer 29 Apr 2013   license: CPOL
Hi,To enable a table for full-text indexing1.Expand the server group, expand Databases, and expand the database that contains the table you want to enable for full-text indexing.2.Expand Tables, and right-click the table that you want to disable or re-enable for full-text...
Answer 29 Apr 2013   license: CPOL
Hi ,You will use sp_exexutesql for this.exec sp_executesql @QueryString,N'@PFactor NUMERIC(18,2)',@PFactorCheck the following linksAdvantage of sp_executesql over Exec[^]SP_EXECUTESQL vs EXECUTE/EXEC[^]sp_executesql (Transact-SQL)[^]Regards,GVPrabu
SQL
Answer 26 Apr 2013   license: CPOL
Hi,Check the following link for Split Function... then u will use one variable for Get the ColumnA value and place in final Select Statement. Like DECLARE @ColA VARCHAR(1000), @ColB VARCHAR(1000)SELECT @ColA = columnA, @ColB = columnB FROM Table_NameSELECT @ColA,ColumnValues FROM...
Answer 26 Apr 2013   license: CPOL
Hi,U can you UDF (User Define Functions) for Split Process then Convert it will works.Check the post... Split function error - The statement terminated. The maximum recursion 100 has been exhausted before statement completion[^]Regards,GVPrabu
Answer 26 Apr 2013   license: CPOL
Hi,You are Compaing NULL in wrong way. Use "IS NULL" for NULL Comparision not "=".Check the links...Comparison Operators (Transact-SQL)[^]SQL Operators[^]-- I changed your Trigger Code. Check the following Script....USE [PRSAppTest_TST]GO/****** Object: Trigger...
Answer 26 Apr 2013   license: CPOL
Hi,Check the Script..SELECT 'emp'+RIGHT('0000'+CAST((ROW_NUMBER() OVER(ORDER BY EmpID)) AS VARCHAR(10)),4)FROM EmpDetailsRegards,GVPrabu
Answer 26 Apr 2013   license: CPOL
Hi,Before Insert Check the record is already existed or not.-- Which column is PK ? then using that U can do as like IF NOT EXISTS(SELECT 1 FROM TenderDetail WHERE Column_Name=Your_Value)BEGIN INSERT Statement SELECT @@IdentityENDRegards,GVPrabu
Answer 25 Apr 2013   license: CPOL
Hi,Some syntax problem, No need to specify every where tablename.Column name.SELECT row_number() Over (Order by CityID) as [Sno],CityID, CityNameFROM dbo.M_CityCheck the following link, You will get Clear Idea abount ROW_Number() Function.How to use ROW_NUMBER() to enumerate and...
Answer 25 Apr 2013   license: CPOL
Hi,Check the Script....SELECT CM.CashDate, CASE WHEN CM.CashType='IN' THEN S.BillNo ELSE E.ExpnsType END 'Details', CASE WHEN CM.CashType='IN' THEN CM.Amount ELSE 0.000 END 'In', CASE WHEN CM.CashType='Out' THEN CM.Amount ELSE 0.000 END 'Out'FROM CashMovementTbl CMLEFT OUTER...
Answer 24 Apr 2013   license: CPOL
Hi,Check the following CodeSELECT DISTINCT OBJECT_NAME(C.ID) FROM syscomments CINNER JOIN FROM sys.procedures P ON P.Name=OBJECT_NAME(C.ID)WHERE C.Text LIKE '%Search_String%'AND P.type = 'P' Regards,GVPRabu
Answer 23 Apr 2013   license: CPOL
Hi,Tel me the delimiter for Differenciate each email IDs. then u can use function and Seperate all Email IDs and put it in Tem Table or Table Type veriable then u can process what ever u want.In Following my Post... check the Answer then u ll get Clear Idea.Split function error - The...
Answer 23 Apr 2013   license: CPOL
Hi Friend,Check the following link....If u are using SQL server 2008 or advance then u can use User Define Type for this...Sending a DataTable to a Stored Procedure[^]Regards,GVPrabu
Answer 23 Apr 2013   license: CPOL
Hi, Try ThisIf you have column names in Array and Data also in another array then DECLARE @SqlStr VARCHAR(1000)SELECT @SqlStr = 'INSERT INTO your_TableName('+@ColumName_Array+') VALUES ('+@ColumnValues_Array+')'EXEX(@SqlStr)-- So Later Colum List and Values Changes also No Problem....
Answer 22 Apr 2013   license: CPOL
Hi,Try this...with Post AS( SELECT Id, Title,ep, row_number() over (partition by Title order by Id) as rowid from tbl_post)SELECT *FROM Post where rowid = 1;Regards,GVPrabu
Answer 22 Apr 2013   license: CPOL
Hi,-- Check the following Select Statement, If its working fine for all your Data then make as VIEW using this SQL StatementSELECT T2.TariffName 'TariffPointsMainName', T1.TariffName 'TariffPointsChildName',ISNULL((SELECT NotesQuantity FROM Table1 WHERE TariffPointsSubId=T2.ParentId AND...
Answer 22 Apr 2013   license: CPOL
Hi,Check the following linkshow to write a dynamic query in sql[^]efficiency of the SQL query[^]Regards,GVPrabu
Answer 19 Apr 2013   license: CPOL
Hi,Its Simple only.... check Logical Operators (OR, AND) in Google.I gave Sample Procedure...CREATE PROCEDURE test@StartDate DATETIME=NULL,@EndDate DATETIME=NULLASBEGIN SELECT Column_List FROM Table_Name WHERE (Date_Field BETWEEN @StartDate AND @EndDate) OR (@StartDate IS...
SQL
Answer 14 Apr 2013   license: CPOL
Hi...Try Dynamic Query as follows.DECLARE @str varchar(100)='1,2,3,4,5,6,7', @SqlStr VARCHAR(1000)CREATE TABLE mytable (ID INT)INSERT INTO mytable(ID) VALUES(1),(2),(3),(4), (5), (6), (7)SELECT @Sqlstr='SELECT * FROM mytableWHERE ID IN ('+@str+')'PRINT...
Answer 14 Apr 2013   license: CPOL
Hi Check the links...Error 29503 Installing SQL Server 2005.[^]SQL Server 2005 Standard 32-bit Error 29503 (SQL Server service failed to start) installing on Win 7[^]Regards,GVPrabu
Answer 14 Apr 2013   license: CPOL
hi....check the following link.... Export data from mdf and ldf files[^]How to recover data from corrupted SQL Server database?[^]SP_ATTACH_SINGLE_FILE_DB failed with error message "The FILE SIZE property is incorrect."[^]Regards,GVPrabu
Answer 8 Apr 2013   license: CPOL
Hi...Check Following link...IN SQL Server, First row Last Column is How to add with second row Columns?[^]Accounts calculation for small office accounts management[^]Regards,GVPrabu
Answer 4 Apr 2013   license: CPOL
Hi ,Use COALESCE() Function like as followsCREATE TABLE #Test (Col1 INT, Col2 INT, Col3 INT, Col4 INT)INSERT INTO #Test(Col1,Col2,COl3, Col4) VALUES(NULL,1,NULL,NULL),(NULL,NULL,NULL,NULL)INSERT INTO #Test(Col1,Col2,COl3, Col4) VALUES(NULL,NULL,2,NULL),(NULL,NULL,NULL,NULL)INSERT...
Forum Message 26 Mar 2013  
Why I got down vote for my Answer...? can you help me in this query[
Answer 25 Mar 2013   license: CPOL
Hi,Check the Following Logic....-- Multiple Update UPDATE PH SET PH.CITY_ID=1,PH.LOCATION_ID=2, PH.UPD_USER_ID=1, PH.UPD_USER_DATE=getdate()FROM QAProfile.HDR_PROFILE PHINNER JOIN QASupport.PROFILE_COUNTRY_SUPPORT PC ON PC.PROFILE_ID=PH.PROFILE_IDWHERE PH.COUNTRY_ID=1--Note :...
Answer 25 Mar 2013   license: CPOL
Hi,Check the Solution.... with Solution 1 Sample DataDECLARE @ct INTSET @ct = 4 SELECT p.productID, p.producteName, p.categoryFROM @products AS p INNER JOIN (SELECT productID, ROW_NUMBER() OVER(PARTITION BY category ORDER BY productID DESC) 'RowNumber' ...
SQL
Answer 25 Mar 2013   license: CPOL
Hi,Use the following Logic ....-- Split Function (Method 1)CREATE FUNCTION [dbo].[fnSplit](@delimited NVARCHAR(MAX),@delimiter NVARCHAR(100)) RETURNS @t TABLE (id INT IDENTITY(1,1), val NVARCHAR(MAX))ASBEGINDECLARE @xml XML SET @xml = N'' +...
Answer 25 Mar 2013   license: CPOL
Hi Friend,Check my Solution... In your Table, U have Unique ID Column means Use the Following Solution. Else Create Temp Table with ID (IDENTITY) Column and Use the Same Solution.DECLARE @pindex TABLE (ID INT IDENTITY(1,1),ICODE INT, ITEM VARCHAR(100), MONTHS SMALLINT,YEARS...
Answer 21 Mar 2013   license: CPOL
Hi Try This....select id,name from table_1union allSELECT T.ID,T.name FROM (select TOP 100 PERCENT id,name from table_2 order by name) TCheck the following link also...Using Derived Tables to Simplify the SQL Server Query Process[^]Regards,GVPrabu
Answer 21 Mar 2013   license: CPOL
Hi Try this...SET DATEFORMAT dmySELECT '22/02/2013'SET DATEFORMAT mdySELECT '03/22/2013'SET DATEFORMAT ymdSELECT '2013/03/22'-- Detault format is "mdy"Check the following link...SET DATEFORMAT (Transact-SQL)[^]RegardsGVPrabu

Page 1 of 5
1 2 3 4 5


Advertise | Privacy | Mobile
Web01 | 2.6.130513.1 | Last Updated 14 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid