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

Method to generate insert statements for data in a table

Hello all. I have a database which will be generated via script. However there are some tables with default data that need to exist on the database. I was wondering if there could be a program that...

View Article


Security context issue when executing a SQL command in SQLCMD

Simplified core issue below: I have myscript.sql that has:SELECT name FROM Sys.Databases GO USE mydatabase GO EXEC mystoredprocedure 'myparameter' GOWhen I open cmd.exe and use:SQLCMD -S...

View Article


Forcing Function recompilation in SQL 2000

A stored procedure in the cache is automatically recompiled when a table it refers to has a table structure change.  User defined functions are not.  Here's a simplified code sample:set nocount...

View Article

Update statement using function

Environment: Win7 and SQL server 2008 R2 Tools: SQL management tool 2008 R2Problem: I have been trying to update id numbers in the staging table. T-SQL statement updates all id number in the staging...

View Article

INSERTING CONCATENATED VALUES IN T-SQL

Ok, this is what I am trying to achieve:My script below is supposed to gather values across three tables and insert them in TO TABLE B in sequence.There are two columns that are being affected in TABLE...

View Article


Removing punctuation from a list of values in a 2 column table with around...

Hi I have a table with two columns and i need to bring back the 1st column as is and the 2nd column needs to come back with all the punctuation's and spaces removed. Below is an example of the values....

View Article

Scientific Notation conversion to text Help needed

I have a column with datatype nvarchar. I need to remove this problem thats happenning often, This is how sometimes the values can be 13343E11466  in my column  but when I run a query it changes to "...

View Article

Best way to read text files at multiple production sites

Need to write a solution to read txt files that contain binary data on multiple SQL Servers. I have no control over the SQL servers, they are not mine. Thinking of BULK INSERT or bcp. But must...

View Article


SQL query result with HTML Data in output

Hello,I have a SQL table , in one column I store HTML data. I need to query the table and get the HTML data in the columns that have 'HREF'. The output shows as grid on the sql management studio,...

View Article


SQL 2008R2: Will SQL process statements (updates/inserts) in order?

Hello SQL Experts,I have some code that updates/inserts some data in a SQL database/table. After reviewing the code in action, I realized that I am opening and closing the SQL connection with each...

View Article

What's wrong

The SP job has been running fine until 2 weeks ago, and the error occurs at 4th line from the bottom in BOLD.Really appreciate any expert advise on this! GO ALTER PROCEDURE [dbo].[UpdateJobs] AS...

View Article

Query

Scenario:Below is the table scriptCreate table dbo.TableA(TID int,Tvalue int,nTime int) Go Insert Into dbo.TableA Values(1,2,4),(2,5,3),(3,6,2) GOTIDTvaluenTime124253362Display result as below based on...

View Article

Best way to determine datediff in minutes

What is the easiest way to determine datediff  in minutes for the following data for:1. minutes between Submitted and QA Ready hStatus 2. minutes between  QA Ready and SignOff hStatus (if request goes...

View Article


error using asp.net2 variable in query for asp.net2 web app

Hi using this query with asp.net2 web app and getting the errorselect * from openquery(GHWPRD, 'select isnull(first_given_name,'') as first_name, isnull(surname,'') as surname, isnull(home_phone,'') as...

View Article

How to Improve Get_ROW_NUMBER with correlated

How to Improve this query please:SELECT     FatherID, Date, Line, ProductCode, StockCode, QtyIn, QtyOut,                          (SELECT     SUM(QtyIn - QtyOut) AS Expr1...

View Article


2 joined crosstabbed tables creating triplicates

What I am attempting:1.Cross-tab 2 tables that contain Monthly Sales (the original text file has a column called month and lists by month. Theend user needs to view by month going across )2. Join Both...

View Article

How to use case when function to calculate time ?

Dear All,May i know how to use case when function to calculate the time ?for the example , if the First_EP_scan_time is 12.30,  then must minus 30 min.   CASE WHEN FIRSTSCAN.EP_SHIFT <> 'R1' AND...

View Article


Delete query running longer

Hi,I have two tables A(110 columns) and B(1 column). Table A is having55 Million records and B is having 0.3 Million records. I am deleting records from A by joining with B like below.DELETE FROM A...

View Article

CURRENT WEEK SQL QUERY

I don't even want to ask as though i know becuase i don't. Im looking for a select statement that grabs current week information based on a date column.  I don't want to pre-set a date range because i...

View Article

how to join two table and get best result?

hi alli have 2 tablesfirst table is:DetailAccount SELECT * FROM DetailAccounti see this resutCode                 Title113                    test13114                    test14115...

View Article
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>