Archive | SQL Server 2000 RSS feed for this section

SQL Functions Fundamentals

6 Jul

Ref:http://www.functionx.com/sqlserver/functions/functions.htm

Advertisements

REFERENCE:SELECT INTO, INSERT INTO

23 Jun

English

Ref:http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/

Spanish

Ref:http://www.guillesql.es/Articulos/SELECT_INTO_INSERT_INTO.aspx

This sometimes can be very handy.

Converting from Varchar to Decimal

25 Mar

Select store, date_value, hour, trans, cast(total as decimal(10,2))as Total_Decimal from hourly_sales
where cast(total as decimal(10,2)) >= ‘800.00’ order by total desc

select max(cast(total as decimal(10,2))) as total_decimal from hourly_sales

Moving SQL Server from one computer to another

1 Mar

Ref:http://vyaskn.tripod.com/moving_sql_server.htm

MS Sql Server Backup & Restore Guide

1 Mar

Very good article

Ref:http://www.informit.com/guides/content.aspx?g=sqlserver&seqNum=4

SQL JOIN EXAMPLE

12 Feb

Ref:http://www.sql-tutorial.net/SQL-JOIN.asp

The SQL JOIN clause is used whenever we have to select data from 2 or more tables.  To be able to use SQL JOIN clause to extract data from 2 (or more) tables, we need a relationship between certain columns in these tables.

My Example:

SELECT  proddta.f0911.GLKCO, proddta.f0911.GLDOC, proddta.f0911.GLDGJ, proddta.f0911.GLJELN, proddta.f0911.GLANI, proddta.f0911.GLAM, proddta.f0911.GLOBJ, proddta.f0911.GLSUB,
proddta.f0911.GLPN, proddta.f0911.GLFY, CONVERT(DECIMAL(10, 2), proddta.f0911.GLAA / 100) AS AMOUNT, proddta.f0911.GLEXA, proddta.f0911.GLEXR, proddta.f0911.GLUSER,
proddta.f0911.GLAID, proddta.f0901.GMAID, proddta.f0901.GMDL01
FROM proddta.f0911, proddta.f0901
WHERE proddta.f0911.GLAID = proddta.f0901.GMAID

Compare two Tables using Left Join

10 Feb

Ref:http://www.todoexpertos.com/categorias/ciencias-e-ingenieria/respuestas/444652/comparar-dos-tablas

1) All records from  Table 1 that Not Exist in Table 2
SELECT Table1.Codigo, Table2.Codigo
FROM Table1 LEFT JOIN Table2 ON Table1.Codigo = Table2.Codigo
WHERE (((Table1.Linea) Is Null));

2) All records from t Table 2 that not exist in Table 1 (invert columns from prevoius example)

My Example Reference:

SELECT A.GMAID, A.GMOBJ, A.GMSUB,A.GMMCU, A.GMDL01
FROM f0901_obj as A LEFT JOIN f0902_obj as B ON A.gmAID = B.gbAID
WHERE (((B.gbAID) Is Null)) order by a.gmobj;

–evick