Skip to main content

Posts

Put Decimal Value in Total query

if ur query return like this 123456789 and u want to put decimal to it try this query SELECT CONVERT(VARCHAR(100),CONVERT(MONEY, 123456789), 1) from BOL The following table shows the values for style that can be used for converting money or smallmoney to character data. Value Output 0 (default) No commas every three digits to the left of the decimal point, and two digits to the right of the decimal point; for example, 4235.98. 1 Commas every three digits to the left of the decimal point, and two digits to the right of the decimal point; for example, 3,510.92. 2 No commas every three digits to the left of the decimal point, and four digits to the right of the decimal point; for example, 4235.9819. hope this help see u

Using Half Size Form in Crystal Reports

i have a hard time trying to solve this one scenario: at first, we using Letter format to print Delivery Order and Invoice..it run smoothly and in CR we just using Letter as the Page Setup.. now new paper format is coming which is half of the Letter size at first i thougt it is easy because we only need to create new paper size on Server Properties under Printer and Faxes then use the new size at Paper Size in CR then redesign it to fit but it all when wrong, eventhough it display correctly but when i want to print it, it turn up everything that vertical become horizontal..very2 strange behaviour so i give using CR.PrintReport method..i ended up format it to .rtf then print it using this code Dim oDoc As New ReportDocument Dim sFileName As String = String.Empty oDoc.Load(_ReportPath) 'must use this line to make sure it print using the new size 'credit goes to Ali from dotnet.netindonesia.net Dim printDoc As System.Drawing.Printing.PrintDocument = New System.Dra...

Resolve Collation error in SQL Server

i often get this error when trying to JOIN some table Cannot resolve the collation conflict between "SQL_Latin1_General_CP850_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. u need to use COLLATION when performing the JOIN, something like this SELECT field1 FROM table1 INNER JOIN table2 ON table1.field3 COLLATE DATABASE_DEFAULT = table2.field4 COLLATE DATABASE_DEFAULT i found this when trying to JOIN, maybe it affect other areas..until i found one see u

Find for SQL Objects, Entities or Text

IF EXISTS (SELECT * FROM Sys.Objects WHERE object_id = OBJECT_ID(N'[dbo].[uspFindObjects]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[uspFindObjects] GO CREATE PROCEDURE uspFindObjects @ObjectType CHAR(2)=NULL, @SearchText VARCHAR(500) = NULL, @SearchType CHAR(1)=NULL, @OrderBy CHAR(1)='N' AS BEGIN /*********************************************************************************************************** Procedure: uspFindObjects Parameters: 1. @ObjectType - Type of object to be searched. - U : Table - P : Stored Procedure - V : View - FN : Function - * : Find All (Tables, SP, Views, Functions) 2. @SearchText - Text to be searched 3. @SearchType - Type of data to be searched - N : Name - C : Column - T : Text 4. @O...

How to search all columns of all tables in a database for a keyword

usage: EXEC SearchAllTables 'Computer' CREATE PROC SearchAllTables ( @SearchStr nvarchar(100) ) AS BEGIN -- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved. -- Purpose: To search all columns of all tables for a given search string -- Written by: Narayana Vyas Kondreddi -- Site: http://vyaskn.tripod.com -- Tested on: SQL Server 7.0 and SQL Server 2000 -- Date modified: 28th July 2002 22:50 GMT DECLARE @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(3630)) SET NOCOUNT ON DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110) SET @TableName = '' SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''') WHILE @TableName IS NOT NULL BEGIN SET @ColumnName = '' SET @TableName = ( SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND QUOTENAME(TABLE_...