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


Author filtered by: Khorshed Alam, Dhaka [x]
Re: My vote of 5 by Khorshed Alam, Dhaka
Article 28 Mar 2013   license: CPOL
How to execute multiple long running SQL Statement Asynchronously in smaller chunks
T-SQL - stored procedure by Khorshed Alam, Dhaka
Answer 10 Mar 2013   license: CPOL
try this one:IF EXISTS ( SELECT NAME FROM sys.procedures WHERE NAME = 'ValidateQty' )BEGIN DROP PROCEDURE ValidateQty;END; GO CREATE PROCEDURE ValidateQty @vStockqty CHAR(10), @Partid CHAR(10)AS DECLARE @CurrentValue INT = ( ...
Answer 10 Mar 2013   license: CPOL
By adding default constraint you can achieve this goal.ALTER TABLE Attendance ADD CONSTRAINT df_Constraint_Attendance_Date DEFAULT GETUTCDATE() FOR [Date] GO ALTER TABLE Attendance ADD CONSTRAINT df_Constraint_Attendance_Status DEFAULT 'P' FOR [Status] GO ...
Answer 7 Mar 2013   license: CPOL
You can use SQL Server Import Export wizard to do this task. Have a look:http://www.66pacific.com/sql_server_import_from_excel.aspx[^]
SQL
Question about Sql query by Khorshed Alam, Dhaka
Answer 6 Mar 2013   license: CPOL
Try this one:SELECT a.in_ts, a.jobCode, b.name 'CompanyName', a.jobName, a.contactPerson, a.cpDesignation, a.location, a.jobType, a.monthlySalary, a.qualification, a.experience, a.remarksFROM ...
Sql Query Problem in fetching data by Khorshed Alam, Dhaka
Answer 6 Mar 2013   license: CPOL
Here you go!!DECLARE @t TABLE (Id INT, Score INT)INSERT INTO @tSELECT 1,10UNION ALLSELECT 1,20UNION ALLSELECT 2,5UNION ALLSELECT 2,10 SELECT MAX(CASE WHEN t.Perf = 'Excellent' THEN t.Score ELSE NULL END) AS Excellent, MAX(CASE WHEN t.Perf = 'Good'...
Join Query in mssql 2005 by Khorshed Alam, Dhaka
Answer 5 Mar 2013   license: CPOL
Try this oneSELECT t.Date, t.ChemicalId AS Chemical, t.Unit, ISNULL(t.StockQty, '-') AS Stock, ISNULL(t.ConsumedQty, '-') AS ConsumedFROM ( SELECT DISTINCT s.Date, ChemicalId, Unit, ...
sql server stored procedure by Khorshed Alam, Dhaka
Answer 5 Mar 2013   license: CPOL
you can use != (not equal to) instead of IF NOT EXISTS( SELECT CompanyCode FROM CompanyMaster WHERE CompanyCode = @CompanyCode AND [Status] = TRUE AND CompanyID != @CompanyID )
Microsoft SQL Server 2012 setup by Khorshed Alam, Dhaka
Answer 5 Mar 2013   license: CPOL
It seems you do not have minimum requirement to install SQL Server 2012.Please have a look on the link below and compare you have all necessary requirement(both hardware and software level) to install it.http://msdn.microsoft.com/en-us/library/ms143506.aspx[^]
SQL
Answer 5 Mar 2013   license: CPOL
Have a look.DECLARE @value VARCHAR(500)DECLARE @Whrcol VARCHAR(500)DECLARE @Whrvalue VARCHAR(500)SET @Whrcol = 'Product Cat3'SET @Whrvalue = 'IR DOME CAMERA'SET @value = 'SELECT [Column Name] INTO TestTable FROM tblProductsCatalog WHERE [' + @Whrcol +'] =''' +...
Answer 28 Feb 2013   license: CPOL
Use transaction in your code.See below:--For Update --Executed by USER1BEGIN TRANSACTIONBEGIN TRY UPDATE [Employee] SET Salary=Salary *.5 WHERE Salary>1000 COMMITEND TRYBEGIN CATCH ROLLBACK SELECT ERROR_NUMBER() AS ErrorNumber, ERROR_SEVERITY() AS...
How to avoid duplicate records in SQL by Khorshed Alam, Dhaka
Answer 28 Feb 2013   license: CPOL
Create an unique index like below:CREATE UNIQUE INDEX IX_FirstName_LastName_Age ON [TableName] (FirstName, LastName, Age)But this is not the preferred approach, you need to have a primary key in this table that will like (let's assume you are working with patient) PatientId,FirstName,...
How to get Table ddl Via Query by Khorshed Alam, Dhaka
Answer 28 Feb 2013   license: CPOL
Try this:SELECT *FROM sys.sql_modules smWHERE sm.definition LIKE '%ObjectName%'
Answer 28 Feb 2013   license: CPOL
Try something like thisDECLARE @T TABLE(tDate date)INSERT INTO @T VALUES ('01-01-2001')UPDATE @T SET tDate =DATEADD(YEAR, DATEDIFF(YEAR,tDate,GETDATE()),tDate)SELECT * FROM @T
Answer 28 Feb 2013   license: CPOL
Please have look on the link below, it scripts object along with data.http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/[^]
Answer 27 Feb 2013   license: CPOL
You can try with OPENQUERY with help of Linked ServerCREATE TRIGGER LogRecordsON mainlogFOR INSERTASBEGIN SET NOCOUNT ON IF EXISTS( SELECT * FROM mainLog ) BEGIN INSERT OPENQUERY(MySQLLinkedSvr,'SELECT * FROM Table') SELECT * FROM ...
Insert/Update row in multiple databases by Khorshed Alam, Dhaka
Answer 27 Feb 2013   license: CPOL
1. If the database resides in same server then use command like belowINSERT INTO DBName.dbo.Customer(Column1,Column2) VALUES('','')2.If database resides in remote server.As you told that you have DBName,Id password in one of your system table so using this value you can use OPENQUERY with...
Answer 25 Feb 2013   license: CPOL
better to rewrite the stored procedure like below:CREATE PROCEDURE smpl @roomno VARCHAR(20), @ondate DATETIME, @offdate DATETIMEASBEGIN SELECT roomno, roomno, offdate FROM [sample] s WHERE s.roomno = @roomno AND s.ondate = @ondate AND...
Error while Updating view by Khorshed Alam, Dhaka
Answer 25 Feb 2013   license: CPOL
1. Increase the column length of CustomerID column of "Orders" table. Currently the column length is less than 8. Make it 8 or above it will work, I hope. 2.Another issue, to make an update able view, keep the following options in mind:The SELECT statement must only refer to one...
Answer 25 Feb 2013   license: CPOL
you can try this link:http://stackoverflow.com/questions/6689962/sql-server-format-date-dd-mm-yyyy-hhmmss[^]
sql server data time convertion error by Khorshed Alam, Dhaka
Answer 24 Feb 2013   license: CPOL
Try this,SELECT *FROM GpsDataWHERE DATE > CONVERT(DATE, '23/02/2013', 103)
Re: My vote of 5 by Khorshed Alam, Dhaka
Forum Message 22 Feb 2013  
Thanks a lot to read the article and your inspiring comment. dsdf
Answer 21 Feb 2013   license: CPOL
Yes you can connect MS Excel as DataSource of SSRS. Just use OLEDB provider. You design SSRS report using your excel data.
how to check time between times in sql by Khorshed Alam, Dhaka
Answer 21 Feb 2013   license: CPOL
It seems the will work only in your system as the following part will not run in every culture. SELECT @ti = CONVERT(CHAR(2), DATEPART(hour, GETDATE())) + ':' + CONVERT(CHAR(2), DATEPART(mi, GETDATE())) + ':' + CONVERT(CHAR(2), DATEPART(S, GETDATE()))You know different culture has...
Slowness of SQLServer Express by Khorshed Alam, Dhaka
Answer 21 Feb 2013   license: CPOL
Please be noted that, SQL Server Express (2008 R@) supports 1 CPU and 1 GB or RAM. As you are running multiple EXE so I think due to lack of memory and CPU, you are getting slower...
Answer 21 Feb 2013   license: CPOL
the main culprit is the following statement.return @messageSQL always expect integer value in return type. But you wanted to pass VARCHAR value via @message.So remove the return statement it will work fine.ALTER PROCEDURE [dbo].[sp_deleteapplicationfromstage1](@applicationnumber INT,...
purge send mail history for mssql by Khorshed Alam, Dhaka
Answer 21 Feb 2013   license: CPOL
Very simple!USE msdbGODELETE FROM dbo.sysmail_sentitems WHERE [subject] LIKE '%abc%'-- Or any other filer criteria
n rows to n/2 colums in sqlserver by Khorshed Alam, Dhaka
Answer 21 Feb 2013   license: CPOL
Here you go!DECLARE @attn TABLE (StaffNo INT, ADate VARCHAR(20), ATime VARCHAR(20))INSERT INTO @attn (StaffNo, ADate, ATime) VALUES ('12345', '12-02-2013', 09.10)INSERT INTO @attn (StaffNo, ADate, ATime) VALUES ('12345', '12-02-2013', 10.03)INSERT INTO @attn (StaffNo, ADate, ATime)...
Answer 21 Feb 2013   license: CPOL
Follow the steps below:1.Use SQL server Export Import wizard. There you will have facility to connect different server with different userid, password.2.At the last window of the package you will have a provision to save your works as a SSIS package(DTS is no longer available from SQL...
Answer 21 Feb 2013   license: CPOL
Try to convert the XML in to a table first then try to update the base table. Have a look.DECLARE @XmlVal XML=' 92 1489420939 129 -370 ...
Answer 21 Feb 2013   license: CPOL
Try like below:DECLARE @sql NVARCHAR(1000)SELECT @StrConfig=ConfigValue FROM lConfig WHERE ConfigName = 'GESDBName'SET @sql='EXEC ' + @StrConfig + '.dbo.pSEL_SyncTechItemLevelByUnitAndItemID'EXEC sp_executesql @sql
Answer 21 Feb 2013   license: CPOL
use this one.SELECT SUSER_NAME()
Answer 21 Feb 2013   license: CPOL
1. Insert the value in a table variable first.2. Check the existence.3. Insert or show message.DECLARE @TmpTbl TABLE (Col1 VARCHAR(100), col2 VARCHAR(100))INSERT INTO @TmpTbl(Col1,Col2)VALUES('EDJ','LP'), ('AGE', 'LP'), ('DJR', 'VG') IF NOT EXISTS( SELECT 1 ...
Answer 21 Feb 2013   license: CPOL
As you did not provide any code snippet I think your query could be like belowSELECT COUNT([uid]) AS [new_count]FROM [Users]This above query will produce the warning if any column of the table contains null value. Better to write the query like belowSELECT COUNT(CASE WHEN [uid] IS...
Reading Excel Fie Record by Khorshed Alam, Dhaka
Answer 21 Feb 2013   license: CPOL
Do not store the records in XML file as unnecessary XML nodes will make your source file bigger. Rather use a delimited text files (csv, or fixed length etc) to store(export) the data.You can design a SSIS package to import the records to database. SSIS has various number of controls that...
Answer 21 Feb 2013   license: CPOL
There are several ways you can do this.1. Use linked server to connect the remote server.2. Use distributed query in sql server like OPENROWSET For exampleSELECT a.* INTO dbo.TestDepartmentFROM OPENROWSET('SQLNCLI', 'Server=Seattle1;Trusted_Connection=yes;', 'SELECT GroupName,...
Database in recovery mode by Khorshed Alam, Dhaka
Answer 20 Feb 2013   license: CPOL
If sqlserver process is killed while running some heavy operations, the database usually goes InRecovery mode. The is an auto recovery process. The database gets in normal mode after a while. However, you can see progress of the auto recovery proces by running the following statements.SELECT...
export Sqlserver ERD by Khorshed Alam, Dhaka
Answer 20 Feb 2013   license: CPOL
1. Install NitroPDF 2. Open SSMS and the diagram (ERD) you want to export.3. Press CTRL+P (to print it in a printer) and select nitro pdf.4. This will export your ERD to PDF file.
Answer 20 Feb 2013   license: CPOL
Does your MSSQLSERVER service account has proper privilege on the folder? Please check and give proper permission if does not exists. Then you will be able to do that, I hope.
Insert Data from Gridview to DB by Khorshed Alam, Dhaka
Answer 20 Feb 2013   license: CPOL
1. If you have only 200 rows and there is less possibility to increase the number of rows in future then you can loop through the data-grid view and make INSERT statements in a string variable at a time and execute the statements using sqlCommand object.2. If you need to insert large volume...
generate .sql file from .mdf by Khorshed Alam, Dhaka
Answer 20 Feb 2013   license: CPOL
You may facing issue on installing SQL Server on window 8. While installing SQL Server on Windows 8 .NET framework 3.5 is not installing automatically. So before that you need to install it manually.But you can not install .NET framework 3.5 with an offline installer (by double clicking the...
case statement in sql 2005 by Khorshed Alam, Dhaka
Answer 19 Feb 2013   license: CPOL
Hi,You can try this style as well:DECLARE @campus INT = ( SELECT campus FROM table1 WHERE campus = 5 )SELECT code, NAMEFROM table1WHERE campus = COALESCE(@campusId, '') = '' OR campus = @campus
Answer 19 Feb 2013   license: CPOL
Sorry, it is not possible to write data to disk using Stored Procedure. You can use SQL Server Export Import Wizard to generate the file and save it as a SSIS package for further use.
Answer 19 Feb 2013   license: CPOL
1.where are views stored once they are created?In the current database. Have a look.To see the view:SELECT * FROM sys.[views] vTo see the view definition(SQL Query) :SELECT * FROM sys.sql_modules sm WHERE sm.definition LIKE '%yourviewname%'2.if indexes are created on views...
Article 19 Feb 2013   license: CPOL
Standardization database object name with SQL Server Policy Based Management.
Answer 19 Feb 2013   license: CPOL
Areyou talk about Database Log file (.mdf) is growing or the debugging log generated by sharepoint?

Page 1 of 2
1 2


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