Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

Convert DDMMYYYY to MMDDYYYY (Datetime)

Hi All-I have a column which is datetime (DDMMYYYY) 31/03/2012 20.30.00 I need to covert this to (MMDDYYYY 03/31/2012 20.30.00.Please I dont want to convert this to Varchar. I want the output in...

View Article


How to pass the value through variable in dynamic query in sql

Hi,i have written below query for dynamically create the table and insert the records from source table.                                    Declare @Sql Varchar(Max) Declare @x int declare @value...

View Article


How to print a record against a value that doesn't exist?

I am trying an INNER JOIN on two columns of date type.I need to compare the two columns and find out if one of the column doesn't have a particular date. In case, there is a mismatch - I want to print...

View Article

Is It Possible To Change The Batch Terminator From Go To ; In Sql Server 2008 R2

Hi Guys,I have some script files which contains dml statements (only Inserts) .I have to run these script files for Oracle and sql server so the statement terminator is ; in oracle and sql server .But...

View Article

Extracting text from a string

Hi,I have this format (varchar) for time:XX<hour>H<minute>M<second>Se.g.01:23:01 am - XX1H23M1SWhat is the best way to extract the time from this format?cherriesh

View Article


How can you get current stored procedure name via T-SQL?

Is there anyway we can get current stored procedure name using T-SQL?

View Article

Arguing on Simple Table Schema

Hi guys, one question, maybe I'm getting crazy. I argued today with a guy that managed a poll for one of my customer. Ok, he sent me a table like this:Name  Quest   Res 1          1         Yes1...

View Article

Join query help

Table 1 - Locations: columns ID and NameTable 2 - Equipment: columns LocationID, NameTable 3 - People: columns LocationID, NameAs implied the locationID fields map back to the the locations table ID...

View Article


Joins between three tables is confusing. Please help!

Hi, Can you help me in understanding Joins between three tables ? Below are the ddl and queries /*create the tables, we only need the one column*/ CREATE TABLE [dbo].[TableA]([c1] [tinyint] NOT NULL)...

View Article


sefty of "EncryptbyPassPhrase"

HelloI want using EncryptbyPassPhrasefor code some serialNumberhow much is  it safe?and is hack of it is easy? (with out password)I found this link to hack but I can not check it.(it make me...

View Article

Where are the designers of the disaster databases?

Nobody ever comes to this forum and claims: "I designed this disaster database".Who comes on the forum is a developer: "I know it is bad design. I did not do it. I just have to live with it. It is in...

View Article

Exporting View Definitions Script Automatically?

I receive a complete updated database every night in a SQL backup file.Each morning a script runs to restores the DB to our SQL server, sets security on the DB and creates a number of views that we’ve...

View Article

Script Sql Find

I would liketo know how tomake a scriptto queryall tablesof adatabasetorecordinspecific

View Article


Best Match Across Multiple Columns

I have a requirement to get the best match between the columns of two tables, so for example:Table AIDC1C2C3C4C5C61AB2ADC3A4D5B6BCTable BIDC1C2C3C4C5C6Match1ABBBDC1, 3, 52ACBCCC1, 3, 5,...

View Article

stored procedure working very slow

CREATE   PROCEDURE dbo.NIC_CPP_LABRESULTS_GetReviewedPatientLabTests_AOS@lPatient int,@nRecordStatusint,@nClassLevel int=5,@nSecurityLevelint=0,@lMap_UserToOfficeint=0 AS SET TRANSACTION ISOLATION...

View Article


HOW TO REMOVE NEGATIVE VALUES IN HOUR & MIN ?

Dear All,How i remove the negative result in hour ?is it can use case when ? ,CASE DATEDIFF(HOUR,(CONVERT(VARCHAR(14),stuff(stuff(FIRSTSCAN.EP_SCAN_DATE,9,0,SHIFTDESC.EP_SHIFT_TIMEFR),9,0,' '),112))...

View Article

How to find outdated statistics in SQL Server?

My question is: How to find outdated statistics in SQL Server 2005 and above?I have seen many solution based on sysindexes.rowmodctr in many blogs/sites as below. SELECT id AS [Table ID] ,...

View Article


using an index

I have created an index on a table, but when I see the execution plan, it is not using this indexHow can force the query to use this indexRegards

View Article

Image may be NSFW.
Clik here to view.

how to select null and is not null value from table?

hi all i have a product table ...SELECT TOP 1000 [ProductId] ,[IsProduct] ,[StoragesRef] ,[UnitRef] ,[ProductName] ,[HasPrice] ,[Comment] FROM [dbo].[Product] pand get this values...now i want select...

View Article

clustered index on a uniqueidentifier column

Hello Friends,Clustered index on a Uniqueidentifier column getsfragmented 99% every few hours.Should I change the index to non-cluster OR any remove index or anything else?Please advise.Column_name...

View Article
Browsing all 23857 articles
Browse latest View live