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

Strip XML tags, add an space between results

I found a function on the internet which works really fast and doesn't require an UDF or CLR that removes the tags in an XML field.  The problem I have with the function I've found is that it...

View Article


Image may be NSFW.
Clik here to view.

Call SP foreach Column in Table (without Cursor)

Hi, Is there a way to call a SP for each row in a table, and to specify the value as a parameter? Like this.... Regards Nicole -------------------------------------------------- Create PROCEDURE...

View Article


How to UPDATE STATISTICS in SQL Server 2000?

Hi All,I am trying to UPDATE STATISTICS for a table in a database and when I do so and verify the count of the table, I still get the old stats from the sysindexes table. I was wondering whenever a...

View Article

tsql challenge - urgent !!!

Dear experts,Input -------Create  TABLE #tmp(Section CHAR(4),Sno INT,Name VARCHAR(20),Value1 VARCHAR(20),Value2 VARCHAR(20),id INT) INSERT #tmp VALUES ('sec1',1,'A','1','5',1000) INSERT #tmp VALUES...

View Article

ROW_NUMBER() and MAX per PARTITION?

This is my query:select market, score, weeknum, ROW_NUMBER() OVER (partition by weeknum ORDER BY weeknum, score asc) AS [OurRank] from MyTable This query returns the following, but I need to calculate...

View Article


How to filter out rows where one column does not equal another on a row?

How can I craft a select statement such that only those rows whose values in two particular columns are different will be returned?I have a table that, simplified, looks sort of like this, which in...

View Article

opening & closing stock

i am using sql server 2008my table is CREATE TABLE [dbo].[tbl_enventry]([TransactionDate] [smalldatetime] NULL,[Item] [char](1) NULL,[RecQty] [int] NULL,[IssueQty] [int] NULL (i have written query...

View Article

Get Financial Year

how do i write a simple select statement to get Financial Year.Our Financial Year runs from 01/04 to 31/03Thanks

View Article


Image may be NSFW.
Clik here to view.

Need a logic to generate serial number for the items having parent and child...

Need a logic to generate serial number for the items having parent and child mappings.Below is the image showing the sample item mapping( the real system has more than 20 levels) with four levels.The...

View Article


GROUP BY rows and do mixed aggregation (MIN by different column)

Hi, I have a Problem I don't get resolved. First to the conditions. My table Looks like this:Table ---------------------------------------------------(IDENTITY)    ID                 |      bigint(PK)...

View Article

Seeking a Great Tutorial on Table Valued Functions and Scalar Valued Functions

Seeking a Great Tutorial on Table Valued Functions and Scalar Valued Functions.If someone knows of some good sites that explaining these things, whether it's reading materials, or videos, or whatever,...

View Article

Search in dynamic columns

i have a 4 tablesD2D--------------------------ID,Name (Id pk)[D2D_IPAddress]--------ID ,D2D_ID,IPAddress           D2D_ID is Foreign key to table D2DD2D_WWN--------------ID...

View Article

Database Questions, please help

Hi Guys,I have a series of questions that I am grappling with. If you can give me an idea, I will greatly appreciate it.Thanks.You are given a table (A, B, C) where A is a low-cardinality attribute, B...

View Article


Sum and Having select statement question

I have a table, similar to below, needing the LocName values, having the same date, added together.I will then delete the Null rows and rename the resulting LocName with the summed value.StoretCode...

View Article

Joining two tables using only foreign keys

Hi All,I have come accros this for the first time regarding joing the tables using only foriegn keys.I have 3 tables Table1, Table2, Table3Table1:Coulmns...

View Article


How to use wildcard to see the table name

Hi, How I can use the woldcard to see the table name. sp_helpSelect * from [.......] where NAME like '%BENE% and OBJECT_TYPE like '%user%'Thanks.

View Article

Need to retrieve body of stored procedure

Hi there,Here is a stored procedure : /************************************************************   * SOME COMMENT  ************************************************************/     CREATE  PROCEDURE...

View Article


VBscript - Parametrized SQL Insert Statement (CM11874)

Good day all,I need to create a VBscript to perform the following:Gather the Supplier Name information from the Company DB, using a Stored ProcedureInsert/Update the results into a temporary SQL...

View Article

DMV's to identify Login credentials

Hi,I need to identify all login accounts and list their granted/denied authorities.Which DMVs will list all Logins and User accounts along with their granted acceauthorities?Thanks,Gary

View Article

Get info of all columns in a database, (like where they are used in all the...

Output Format -- not in particular order, but these 5 columns Column_name Table_Name Schema_Name Procedure_Name Database_Name(where this column is used)

View Article
Browsing all 23857 articles
Browse latest View live


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